Eubolist's Blog

about IT, Linux, the web and much more

Archive for the ‘Ubuntu’ Category

Anki: An Intelligent Study Card System For Any OS

with 3 comments

A month ago I was looking for a new computer-based method to improve my study schedule. After a bit of searching in the endless depth of the web I discovered Anki, a flash card application that has several very useful features:

  • It is written in Python and available for Windows, Linux, Mac OS X and FreeBSD – which means it runs on virtually any computer.
  • There are a lot of  “Decks” (=sets of flashcards built by other users) already available on the web
  • The interface is really nice and intuitive, adding sound, video or pictures to your cards is very easy, thus can be accomplished by people with little experience with computers. Also there are many options to adjust the program to your study habits.
  • Anki uses spaced repetition. After each card you have to say how well you remembered it – based on that Anki will set the interval after which the card will be brought up again. With this technique facts will be pushed into your long-term memory. That means you won’t experience black outs in exams anymore as the hormone cortisol, released by your body in situations of psychological stress, only affects the short term but not the long term memory.

If that made you curious, why don’t you give it a try! Here are the download links:

Windows

Ubuntu (you can also install it with apt-get/aptitude, but the version in the repositories is pretty old)

Linux

Mac OSX

FreeBSD

Advertisements

Written by eubolist

2010/03/14 at 21:10

Install MythTV 0.22 on Ubuntu 9.04 Jaunty Jackalope

with 2 comments

If you want to install the newest version of MythTV on Jaunty, here’s what you have to do:

  1. Add the following lines to your /etc/apt/sources.list:
    deb http://ppa.launchpad.net/mythbuntu/repos/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/mythbuntu/repos/ubuntu jaunty main
  2. Add the Mythbuntu key by typing the following command: gpg –keyserver hkp://keyserver.ubuntu.com:11371 –recv-key 1504888C && gpg -a –export 1504888C | sudo apt-key add –
  3. Update your list and install Mythbuntu-repos: sudo aptitude update && sudo aptitude install mythbuntu-repos && sudo aptitude safe-upgrade

Written by eubolist

2010/02/07 at 21:04

Ubuntu GNOME AirLines Theme from Bisigi

leave a comment »

I just discovered this awesome theme for your Gnome desktop, it looks really sleek and the wallpaper changes depending on the time of day. Check it out:

AirLines Theme Picture 1AirLines Theme Picture 2

To install this theme first add the bisigi repository and then run the following command in a terminal:

sudo aptitude install airlines-theme

Written by eubolist

2010/02/07 at 20:31

Ubuntu 10.04 Lucid Lynx: Dual Screen with nVidia GeForce MX 460 and nvidia-glx-96 legacy driver

with one comment

Uprgrading to Lucid Lynx Alpha 2 somehow messed with my dual screen configuration, here is what you have to do to reconfigure it again:

1. Install the proprietary driver: sudo aptitude install nvidia-glx-96

2. Backup your xorg.conf file sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

3. Change your xorg.conf file to the following (sudo nano /etc/X11/xorg.conf):

Section “ServerLayout”
Identifier     “Layout0”
Screen      0  “Screen0”
InputDevice    “Keyboard0” “CoreKeyboard”
InputDevice    “Mouse0” “CorePointer”
EndSection

Section “Files”
EndSection

Section “InputDevice”
# generated from default
Identifier     “Mouse0”
Driver         “mouse”
Option         “Protocol” “auto”
Option         “Device” “/dev/psaux”
Option         “Emulate3Buttons” “no”
Option         “ZAxisMapping” “4 5”
EndSection

Section “InputDevice”
# generated from default
Identifier     “Keyboard0”
Driver         “kbd”
EndSection

Section “Monitor”
Identifier     “Monitor0”
VendorName     “Unknown”
ModelName      “Unknown”
Option         “Twinview” “True”
Option         “TwinviewOrientation” “RightOf”
Option         “UseEdidFreqs” “True”
HorizSync       30.0 – 110.0
#    VertRefresh     50.0 – 150.0
VertRefresh     60.0
Option         “DPMS”
EndSection

Section “Device”
Identifier     “nVidia Corporation NV17 [GeForce4 MX 460]”
Driver         “nvidia”
VendorName     “NVIDIA Corporation”
EndSection

Section “Screen”
Identifier     “Screen0”
Device         “Device0”
Monitor        “Monitor0”
DefaultDepth    24
SubSection     “Display”
Depth       24
Modes      “1280×1024” “1024×768”
EndSubSection
EndSection

You might need to play around a little with the options (such as the resolution). My advice is to use a second computer (preferably a laptop) and ssh into the first computer that you want to configure. That way you can comfortably comment out or add single lines to your xorg.conf even if you don’t have a visual picture.

If everything fails just revert back to the default xorg.conf with either one of the following commands:

sudo cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf

or

sudo dpkg –reconfigure -phigh xserver-xorg


Set up LIRC to control your Ubuntu/MythTV Box with a Microsoft Media Center Edition (MCE) infrared remote control

with one comment

I wanted to control my MythTV-Box like I used to control my old receiver with a good old fashioned IR remote rather than with keyboard and mouse. That’s why I went to eBay and bought myself a cheap MCE remote, you can have them shipped from China for less than 20 bucks:

I didn’t know whether the device was Linux compatible, so I just plugged it in and took it from there:

~$ lsusb

Bus 003 Device 002: ID 045e:006d Microsoft Corp. eHome Remote Control Keyboard keys

Looks good. Let’s install the latest version of lirc:

~$ sudo aptitude update && sudo aptitude install lirc

Then let’s check whether lirc picks up correct signals from our remote:

~$ irw

Then press the OK or any other button and the output should look somewhat like this:

000000037ff07bdd 00 OK mceusb

If it does: Congratulations, you’ve got a lirc compatible infrared remote! Exit irw by pressing [Ctrl + C].

LIRC normally runs at system start as a daemon (=runs in background). It reads a file called “.lircrc” in your home directory, in this file you can specify a command for each button. You can even specify custom keybindings for different programs, let’s have a look at my .lircrc file:

~$ cat .lircrc

include /home/eubolist/.mythtv/lircrc                             –> Here we specify which configuration
include /home/eubolist/.lircfiles/vlc                                       files to include in addition to this one
include /home/eubolist/.lircfiles/rhythmbox

begin
prog = irexec                –> irexec means that lirc will
button = Home                   pick up your command no matter which program is running
config = python /home/eubolist/ir-scripts/mythfrontend.real.py 
end

begin
prog = irexec
button = TV
config = python /home/eubolist/ir-scripts/miro.py
end

begin
prog = irexec
button = Videos
config = python /home/eubolist/ir-scripts/vlc.py
end

begin
prog = irexec
button = Music
config = python /home/eubolist/ir-scripts/rhythmbox.py
end

begin
prog = irexec
button = Power
config = python /home/eubolist/ir-scripts/onoff.py
end

Now you may ask yourself why I have some Python scripts specified as actions when I press certain buttons. The reason is simple, let’s have a look at vlc.py:

##!/usr/bin/python
import commands
import os
import sys
import subprocess

output = commands.getoutput(‘ps -A’)

## Check whether vlc is running:              –> As I usually don’t need multiple instances of the same
if ‘vlc’ in output:                                    program running I want to check whether it’s already open

## If yes: either shut the process down
#       os.system(‘/usr/bin/killall vlc’)

## or do nothing:
sys.exit(0)

## If not: Open vlc and end this script:

else: pid = subprocess.Popen(‘/usr/bin/vlc’).pid       –> If you just use os.system() again here the
sys.exit(0)                                        script will just stay open and keep irexec busy, if you press the button again it woud get queued and run again once you exit vlc

Now have fun toying around with Ubuntu and your ir remote control. If you have any questions, thoughts or criticism you are welcome to write a comment.

Howto: PPTP VPN Server with Ubuntu 10.04 ‘Lucid Lynx’

with 20 comments

This tutorial describes how you set up a computer as a dedicated VPN server for your network. With a VPN server you can open secure data tunnels and access files and deivces in your local network (eg. home or office) from remote locations, which is not only a pretty cool thing (accessing your media library from anywhere) but also very handy for system maintenance or customer support or if you want to work from home.

VPN scheme

A simple scheme how VPN works: Through your VPN server you will have full, secure access to your LAN (source: caconsultant.com)


Note that Lucid Lynx is still in Alpha 2 stage at the time of writing this article, this means you should only use it for testing purposes. Although the server I’ve set up writing this tutorial has been running without any kind of problems for two weeks now I recommend if you want to set up a Ubuntu server in a working environment you to go back to 9.10 ‘Karmic Koala’ or even an earlier stable version. Okay, this being said
let’s get started:

1. Download the Lucid Lynx Alpha 2 server CD image from this page: http://releases.ubuntu.com/releases/10.04/

2. Follow the installation wizard and install the core system

3. Under software selection select OpenSSH server – for remote management of the machine – and manual package selection for the actual pptpd package. If you want more services, for example if you want to use the computer also as a webserver, you may of course select the additional software. For security reasons I generally advise people to only run one from the outside accessible service per machine if set up in a critical environment, but really that’s up to you.

Lucid server install, software selection

Software selection

4. In manual selection navigate to ‘not installed packages’ -> ‘net’ where you will find pptpd. Select it and press ‘g’ twice in order to install the package.

Lucid server install package selection

Package selction --> PPTPd

5. Let the installation finish and reboot your system.

6. SSH into your newly set up machine and run ‘sudo aptitude update && sudo aptitude safe-upgrade’ first to update all packages. Reboot if necessary.

7. Open the pptpd.conf file: ‘sudo nano /etc/pptpd.conf‘ Adjust the IP settings at the bottom to your needs. Under local IP you enter the IP in the local network of your VPN server (if you don’t know it type ‘sudo ifconfig’ and it will show you your network interfaces and the assigned IPs). For that matter I recommend to set up a static IP in /etc/network/interfaces or in your router configuration.

8. If you want to, you can change the hostname in /etc/ppp/pptpd-options

9. Specify the user names and passwords you want to give access to your vpn: ‘sudo nano /etc/ppp/chap-secrets‘. If you changed the hostname in the step before make sure you type in the same hostname now under ‘server’

Example:

# client server secret IP addresses
eubolist pptpd myübersecretpassword *

As in pptp there is no keyfile security depends solely on the password. Which is why you should choose a long (eg. 32 characters), random password. You can generate such a password here.

10. Now we need to set up ip-masquerading: ‘sudo nano /etc/rc.local

Add the following lines above the line that says ‘exit 0

# PPTP IP forwarding

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Optionally I recommend securing your SSH server against brute force attacks:

# SSH Brute Force Protection

iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW -m recent –set –name SSH
iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW -m recent –update –seconds 60 –hitcount 8 –rttl –name SSH -j DROP

(also to be inserted above ‘exit 0’)

You may have to change ‘eth 0’ to another interface, depending on which interface is configured to connect to the internet on your machine.

11. Lastly, uncomment this line in /etc/sysctl.conf:

net.ipv4.ip_forward=1

12. Reboot

13. In case your vpn-server doesn’t directly connect to the internet you may need to forward port 1723 TCP and GRE to the LAN IP of your vpn-server. Refer to your router’s manual or to portforward.com for vendor specific instructions.

Done. Enjoy!

UPDATE(2010-07-18): If connecting to the vpn-server goes well but you can’t connect to the internet you might want to try uncommenting the ms-dns entries in /etc/ppp/pptpd-options so it looks like this:

ms-dns 208.67.222.222
ms-dns 208.67.220.220

Written by eubolist

2010/01/28 at 15:56