Home » Projects » Linux Media Center

The Linux Media Center Guide version 1.1

(Thanks to all the people sending me comments on improving this guide! A version for Ubuntu 7.04 is coming up soon.)

First off; this is an advanced guide. It doesn't talk you through all wizards and expects people to have basic linux skills. It should be enough however for anybody who would attempt to build a LMC to get it up and running. If something's wrong or things work differently, let me know.

The hardware demands are minimal. I use a 1GHz P3 with a 120GB harddisk and 256MB+ Ram and a Hauppauge PVR250. A PVR150 will do just as well and is very standard an relatively cheep. Just add a simple DVD player and a videocard with TV-Out and you're ready to roll. I added a €15,- DVD player and a €25,- NVidia FX5200.

First, install a basic ubuntu 6.10 desktop. Get an image from the Ubuntu website.

Next, add an ssh-server so we have remote access:

 apt-get install openssh-server

Next we want to add some repositories for the ivtv driver. This driver is needed for the Hauppauge card that isn't natively supported by the kernel.

Edit /etc/apt/sources.list and remove the '#' at lines with universe and add 'multiverse' and add the hellion repository. A basic sources.list should look like this (notice I commented out the cdrom. We'll never use that one again):

# deb cdrom:[Ubuntu 6.10 _Edgy Eft_ - Release i386 (20061025.1)]/ edgy main restricted
 deb http://nl.archive.ubuntu.com/ubuntu/ edgy main restricted
 deb-src http://nl.archive.ubuntu.com/ubuntu/ edgy main restricted

 deb http://nl.archive.ubuntu.com/ubuntu/ edgy-updates main restricted
 deb-src http://nl.archive.ubuntu.com/ubuntu/ edgy-updates main restricted

 deb http://nl.archive.ubuntu.com/ubuntu/ edgy universe multiverse
 deb-src http://nl.archive.ubuntu.com/ubuntu/ edgy universe multiverse

 deb http://security.ubuntu.com/ubuntu edgy-security main restricted
 deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted

 deb     http://www.hellion.org.uk/debian sid main
 deb-src http://www.hellion.org.uk/debian sid main

Before we can use the hellion repo, we need to tell the system to trust it. Get the keys and install them like so:

 wget http://www.hellion.org.uk/public_key.asc
 apt-key add public_key.asc

Now it's time to see what packages are out there and upgrade our packages to the latest version:

 apt-get update
 apt-get upgrade

We can now install the ivtv drivers and firmware. CHECK YOUR KERNEL VERSION SUPPORT at http://ivtvdriver.org. Very important because if you get the wrong version it won't work. For the installed Ubuntu 6.10 kernel (2.6.17) we need ivtv 0.70.

 apt-get install ivtv0.7-* module-assistant debian-builder
 module-assistant prepare
 module-assistant auto-install ivtv0.7
 wget http://dl.ivtvdriver.org/ivtv/firmware/firmware.tar.gz
 tar zxvf firmware.tar.gz -C /lib/firmware
 chown root:root /lib/firmware/*

Next we disable default X-server (graphic shell) so we can start our own and we add encrypted DVD playback support:

 update-rc.d -f gdm remove
 apt-get install libdvdread3 libdvdnav4
 /usr/share/doc/libdvdread3/install-css.sh

Now we add the NVidia driver:

 wget http://us.download.nvidia.com/XFree86/Linux-x86/1.0-9746/NVIDIA-Linux-x86-1.0-9746-pkg1.run
 sh NVIDIA-Linux-x86-1.0-9746-pkg1.run

Time to install mythtv and set up the tv guide (which is essential for mythtv to work!):

 apt-get install mysql-client mysql-server mysql-common
 apt-get install mythtv-backend mythtv-common mythtv-database mythtv-frontend mythtv-doc
 apt-get install xmltv
 cd /usr/local/bin
 wget http://visualization.tudelft.nl/~paul/grabber/download/tv_grab_nl_py
 chmod ugo+x tv_grab_nl_py
 mv /usr/bin/tv_grab_nl /usr/bin/tv_grab_nl.backup
 ln -s /usr/local/bin/tv_grab_nl_py /usr/bin/tv_grab_nl
 su - mythtv
 tv_grab_nl --configure
 tv_grab_nl --output ~/tvguide --days 1

Now edit the ~/.xmltv/tv_grab_nl_py.conf file to remove any channels you don't want.

Now we need to switch to X and start mythtv-setup as the mythtv user:

 export DISPLAY=:0
 mythtv-setup

Do the first basic setup like language and database selection, then quit setup. We'll not let mythtv-setup add the tvguide since we already got one:

 mythfilldatabase --file 1 -1 ~/tvguide

And start mythtv-setup again and run through the whole wizard. Don't forget to add channel numbers or frequencies to the TV stations! If you don't there won't be much TV watching going on.

 mythtv-setup

ok, we're almost done. Next we make the system autologin to X and run the frontend:

 apt-get install mingetty
 vi /etc/event.d/tty1

Change the line starting with 'respawn' to:

 respawn /sbin/mingetty --noclear --autologin mythtv tty1

And do some userstuff so things happen automagically. First edit ~mythtv/.bash_profile and add:

 exec startx

Then edit ~mythtv/.xinitrc and add the following content:

 #/bin/sh
 xset -dpms s off
 setterm -blank
 setterm -powersave off
 xset s off
 alsactl restore
 irxevent &
 irexec /home/mythtv/.lircrc &
 exec mythfrontend > /home/mythtv/mythfrontend.log 2>> /home/mythtv/mythfrontend.err

Now we add mythtv to the hardware groups so he can actually read from it:

 usermod -G cdrom,audio,video mythtv

And finally, add the remote control:

 wget http://prdownloads.sourceforge.net/lirc/lirc-0.8.1.tar.bz2
 tar jxvf lirc-0.8.1.tar.bz2 -C /usr/src
 apt-get install lirc lirc-x lirc-modules-source linux-source
 cp /boot/config-2.6.17-10-generic /usr/src/linux/.config
 ln -s /usr/src/linux/drivers /usr/src/lirc-0.8.1/drivers/
 /usr/src/lirc-0.8.1/setup.sh
 make install
 echo "alias char-major-61-* lirc_i2c" >> /etc/modprobe.d/aliases
 modprobe lirc_i2c 

Now give it a reboot and see if everything works the way it should.

If your tv shows a black and white screen, try adding the next line to your xorg.conf in the nvidia device section

 Option "TVOutFormat" "COMPOSITE"