Page Description
This page will describe how to install MythTV onto your Ubuntu linux computer. MythTV is a 'Tivo' like system; it allows you to watch, pause, and record televsion. These instructions were created using Ubuntu 5.10 (Breezy Badger). They are written for the basic Linux user, however a knowledge of Linux commands will be helpful when installing myth. In addition to just installing myth, this tutorial will also tell you how to install IVTV (the driver and firmware required for the Hauppauge capture cards pvr-150, 250, 350, and 500). And, it will show you how to install LIRC, the software driver required to use remote controls.
During this tutorial, you will be required to enter commands into the computer (if you don't know how to enter commands in, this will be described). The commands will be presented in the following box.
%Command goes here.
The command does not include the percent sign '%'. This is presented to represent the terminal.
Upgrade Ubuntu for Installing MythTV
Access a terminal by selecting Applications->Accessories->Terminal. (Applications is presented at the top of the computer window). You will be presented by a terminal window. To issue a command in the terminal window, type in the command and press enter.
You must first create a root password (optionally, do not create a root account, and use the sudo command before all relevant commands). Set the 'root' password by entering in the following command.
%sudo passwd root
The command will ask you for your password, and then ask for the new UNIX password. Enter these in.
You will now enable the upgrade to include upgrades in the 'Universe' and 'Multiverse'. Do this by selecting Settings->Repositories Press the 'Add' button Check the 'Community-Material (Universe)' checkbox Check the 'Non-Free (Multiverse)' checkbox. Don't worry, to my knowledge doing this does not cost money at any time. Select the 'Oks' and let the packages download. Press the 'Close' button and exit out of the 'Add Applications' window.
Now, switch to become the root user.
%su
Enter the password created earlier with sudo command.
Update and upgrade Ubuntu by entering the following series of commands.
%apt-get update %apt-get dist-upgrade %apt-get upgrade
You now need to download required packages used to install Myth.
%apt-get install build-essential
In addition to the above, Myth also requires gcc-3.4. Alternativey, instead of downloading another version of gcc, you could make symbolic link that's named gcc-3.4 but links to gcc compiler version installed with Ubuntu
%apt-get install gcc-3.4
Your Ubuntu computer is now ready to begin the process of installing and setting up Myth.
MythTV Prerequisites
Myth requires Apache and Mysql; we will install these now. The following information was derived from the following website: http://www.slash32.com/ubuntu-myth.html. Download and install apache2 and mysql-server.
%apt-get install apache2 %apt-get install mysql-server
The mysql-server will ask for further information. Choose 'setup internet site'. I used the default values from then on. If you're smarter than me, change them as needed. Then install phpmyadmin.
%apt-get install phpmyadmin
Now you will setup what you just installed. Open the Firefox web-browser; enter 'localhost' into the website address. Click on phpmyadmin. Enter 'root' into the user name field box, leave the password field empty and press ok. Click on change password. Enter in the new root password you created earlier in both field boxes and press ok. Press 'logout'. Now, enter root as the username and nothing in the password box. If what you did worked, you just got denied. Now enter 'root' as the username and the password you chose in the password field box. Press enter. If you get logged in, then everything worked well. Logout again.
Download and Install Myth
We will now download and install MythTV. To do this we will use synaptic manager. Select System->Administration->Synaptic Package Manager. Right click anything with Myth in front of it and mark for installation. Mythgame and Mythphone have problems. We'll get to this later. Click 'Apply'; click 'Apply' again. Watch the packages download. In addition to MythTV, use synaptic package manager to download lynx and ncftp. Follow the procedure you just followed for these new packages. Be sure to download the necessary dependant packages as well.
Installing IVTV
IVTV is the driver necessary for the Hauppauge Hauppauge pvr-150, 250, 350, and 500 cards. If you have other capture cards, this may not apply to your card.
Visit http://ivtvdriver.org and download the latest stable release of the driver. I downloaded ivtv_0.4.0.tar.gz. You now need to unzip the file. Do this by double clicking on it, and using the Ubuntu unzip utility to extract it to the desktop (press the extract button). You no longer need the *.tar.gz file. Feel free to delete it.
Open up a terminal (Applications->Accessories->Terminal). In your home directory, create a directory called Software.
%mkdir Software
Navigate into that directory
%cd Software
Make a directory for all of your television software
%mkdir tv
Navigate into that directory
%cd tv
Move the Driver directory into the current directory
%mv ../../Desktop/ivtv-0.4.0 ./
Move into the driver directory
%cd ivtv-0.4.0
Download soemthing that makes 'make' work. This information was attained from the following website: http://ubuntuforums.org/archive/index.php/t-2878.html.
%apt-get install linux-headers-$(uname -r)
Now make the driver
%make
Now install the driver
%make install
The output of make install lists some conflicting files. It suggests several move commands to 'HIDE' these files. Follow these commands by copying and pasting them into the command line and pressing enter. (Press enter for each command individually). Then make the install again.
%make install
Hopefully the install went well for you. On my machine, it installs into the wrong directory. So we need to copy it. We first need to find where it went. Type in the following to accomplish this.
%find / -name ivtv
This command should reveal the location of the ivtv driver. Now we need to copy it to where it should go.
%cp -r <result_of_find_command> /lib/modules/<your_kernel_number>/kernel/drivers/media/video
If you don't know your kernel number for the above command, enter the following command.
%uname -r
Copy it to another location as well (this really shows you how little I know about what I'm doing. I got it working, so that part's good.)
%cp -r <result_of_find_command> /lib/moudles/<your_kernel_number>/
Now we need to generate the modules.dep and map files. Do this by typing the following.
%depmod
And now we need to add those modules to the linux kernel. Do this by entering the following command.
%modprobe ivtv
You now need to edit a driver file. The following command suggests using gedit; feel free to used any other text editor.
%gedit /etc/init.d/ivtv
Add the following line to the file (it might be the only line in the file). Note: do not include the quotes (') in the line. Just add what's inside the quotes.
'modprobe ivtv'
Now make the ivtv executable.
%chmod +x /etc/init.d/ivtv
Update the modules that start on boot up
%update-rc.d ivtv defaults 50
Check to see if the driver is working. As root, issue the following command.
%dd if=/dev/video0 of=/dev/video16
After a few seconds, push 'Control-C'. You should get an output that looks like this:
30696+49 records in 30720+0 records out
If you got this, then the drivers are workign well. Note: /dev/video16 is the hardware decoder that comes with the Hauppauge pvr-350. If you don't have the 350, then you may not get any records out.
How are you feeling so far? Feeling good? Things are going well. Only a bit further.
Let's look at the output of the modprobe command. %dmesg | less
Note: if you don't know how to use less, type '%man less' before issuing the above command. (In general, the 'man' function is used to get explanations about the command being 'manned'.) If you scroll to the bottom of the ivtv section, you can see that several errors occurred. This is because we have yet to install the firmware for our capture card (I used the Hauppauge pvr-350). We will do that now. Open up Firefox web browser. Again visit http://ivtvdriver.org. Click on the 'firmware' link.
Here you get some really cryptic messages for what you want to do with the Hauppauge pvr-350. I'll tell you what I did. If you find a better way, please edit this page accordingly.
The first thing we see is that the hotplug mechanism will be used starting with driver ivtv-0.4.1. That means if you use a release later than 0.4.0, this document is out of date. I welcome you to figure it out and let everyone else know how to do it by improving this document. If you're still using ivtv-0.4.0, then download the following files: pvr_2.0.24.*.zip and pvr_1.18.21.22254_inf.zip and save them to your desktop.
In your tv directory (within your Software directory) make a pvr_firmware directory
%mkdir /home/<your_user_name>/Software/tv/pvr_firmware
If you don't know your username, enter the following command.
%whoami
Move into the newly created directory.
%cd /home/<your_user_name>/Software/tv/pvr_firmware
Move the zip files into the current directory.
%mv /home/<your_user_name>/Desktop/*.zip ./
Now run a perl utitilty that came with the ivtv driver
%../ivtv-0.4.0/utils/ivtvfwextract.pl pvr_1.18.21.*_inf.zip.
Note: we have not yet used the pvr_2.*.zip file. This will be used later for the hardware decoder.
Now we have to get some additional modules. At this point, let me say my two cents. Thank you to all the developers who have created Myth, ivtv, and linux in general. Open source is an amazing solution to software development. Ubuntu, in general, rocks. This would all be so much harder if it were not for this new, beautiful, distribution of linux. Thank you so much to all the people that have created help files describing their experiences with Myth installations. I would not have been able to do it without you all. Ok, back to the additional modules.
Open a firefox browser and visit http://www.pcxperience.org/james/ivtv. Download the Video::Frequencies and Video::ivtv modules by clicking on the links. For each module, do the following: Unzip the file and extract the internal directory to the desktop (as done before). Move the directories into your pvr_firmware directory.
%mv /home/<your_user_name>/Desktop/Video* /home/<your_user_name>/Software/tv/pvr_firmware
Navigate to the firmware directory.
%cd /home/<your_user_name>/Software/tv/pvr_firmware
Navigate into the Video Directory.
%cd Video-Freq*
Use perl utility to create a makefile
%perl Makefile.PL
Now make the makefile you just made (get it?).
%make %make install
Repeat for the Video::ivtv module
Use CPAN to install IniFiles. It takes a while to go through all the options. I selected default for most of them. You'll be fine.
%cpan -i Config::IniFiles
Navigate back to the ivtv driver directory
%cd /home/<your_user_name>/Software/tv/ivtv-0.4.0
Make and make install
%make %make install
Restart your computer by selecting System->Logout->Restart. Open a terminal and become root user
%su %depmod %modprobe ivtv
Now check the output of modprobe.
%dmesg | less
The ivtv portion should have no errors. Restart your computer. Switch to root user. Navigate to the ivtv directory.
%cd /home/<your_user_name>/Software/tv/ivtv-0.4.0
Navigate to the directory with ptune in it.
%cd ./utils/perl
Test the capture card with ptune.pl. Type '%perl ptune.pl' to see how to use it.
%perl ptune.pl -c 8
The above command assumes you have channel 8. I suggest testing several channels; do this by replacing the '8' in the above command with the appropriate output. If the output is something like: 'Ch.8: 181250 2900' then the card is working. If it worked, edit an aliases file. Perform the following.
%cp /etc/modprobe.d/aliases /etc/modprobe.d/aliases.orig %gedit /etc/modprobe.d/aliases
Now find the following line:
- 'alias char-major-81 videodev'
After that line, add the following line
- 'alias char-major-81-0 ivtv'
An additional card could be added as 81-1
You've completed installation of the firmware.
Upgrade the firware to latest verison
Upgrade the firmware to version 2.0.24.23035. Visit the ivtv website and download the driver of the above version www.ivtvdriver.org/index.php/Firmware. Unzip the file. Copy the HcwMakoA.ROM file to /lib/modules/ Copy the HcwFalcn.rom file to /lib/modules/ivtv-fw-enc.bin
%depmod %modprobe ivtv
Then restart your computer.
MythTV Configuration
Create a username and password for a mythtv user in the sql database. if you're not the root user, switch to it.
%su
Then enter the following set of commands
%mysql -u root -p mysql mysql> UPDATE user SET password=PASSWORD('mythtv') WHERE user="mythtv"; mysql> FLUSH PRIVILEGES; mysql> quit
Enter a password other than mythtvif you would like. Just remember the one you enter.
Finally, on to MythTV! Navigate to your home directory.
%cd /home/<your_user_uname>
Make a password for the mythtv user
%passwd mythtv
Enter in a password (I suggest making it the same password used for the sql database). Now you need to disable a security feature; remember to enable it again later.
%xhost +
You can enable it later by typing %xhost -. Change to the mythtv user.
%su mythtv
Enter Myth Setup
%mythtv-setup
For instructions on how to install MythTV, you can visit www.mythtv.org. I found great information on how to configure MythTV by visiting www.systm.com. They used KnoppMyth, but the Myth configuration issues they suggest are relevant. Note: It's important to run the myth tv setup as the mythtv user. Fill the listings of myth; I used information from the following website to figure out the following set of commands http://mythtv.org/pipermail/mythtv-users/2005-February/076574.html.
%mythfilldatabase
This takes a long time. Don't worry if you get some errors - some errors are ok. Myth will be the test of whether or not it worked out.
We will now start our first Myth session. As the mythtv user, start the myth backend.
%mythbackend -d
I also used the following website for informatoin on these commands, http://www.mythtv.org/docs/mythtv-HOWTO-singlehtml.html. The above command will start the myth daemon. Restart the computer System->Logout->Restart. Now start up myth!
%mythfrontend
Myth will tell you that it couldn't connect to the database and give you some options. Tell Myth the username and password of your mysql database you entered earlier in this tutorial.
You should be able to watch TV at this point. If you can't it's likely that you didn't setup myth properly. Please revisit mythtv-setup.
Setting up the Hauppauge Remote Control with LIRC
For this section, I referred to the following websites: http://ubuntuforums.org/showthread.php?t=30612&highlight=lirc, and http://www.abarbaccia.com/content/view/18/31/.
This section will explain how to install LIRC and get the Hauppauge remote control working. We need to install the Linux Kernel source code. First, we find the kernel version.
%uname -r
This yields something like 2.6.12-10-386. We will use the first three numbers.
%apt-get install linux-source-<kver>
where <kver> are the first three numbers. Now we need to extract the source we just downloaded and link it to the right directory.
%tar xvjf /usr/src/linux-source-*.tar.bz2 -c /usr/src/ %ln -s /usr/src/linux-source-<kver> /usr/src/linux %ln /usr/src/linux /lib/modules/$(uname -r)/build %cp /boot/config-$(uname -r) /usr/src/linux/.config %cd /usr/src/linux %make oldconfig %make /include/linux/version.h %make modules
The last command takes a LONG time. Relax, and get something to eat. You've been working hard.
Visit the LIRC homepage and download the latest LIRC software to your desktop http://www.lirc.org. Unzip the firmware using the Ubuntu unzip utility as discussed before and extract it to your desktop. Feel free to delete the zip file now. In your Software/tv/pvr_firmware directory, make a directory called remote_control
%cd ~/Software/tv/pvr_firmware %mkdir remote_control
Move the lirc* directory to the remote control directory
%cd remote_control %mv ~/Desktop/lirc* ./
Install Dialog
%apt-get install dialog
Move into the lirc directory
%cd lirc*
Run setup
%./setup.sh
Select Driver Configuration. Select TV Card. Select 'Hauppauge TV Card'. Choose 'Save Configuration and Run Configure'. Then, make and install.
%make %make install
Note: If there are errors during the make or make install, then might try performing the following command.
%touch /usr/src/linux/Rules.make
I did not need that command, but others on the internet claim it was the key to their success. Now re-run make and make install. Then, install the lirc module.
%depmod %modprobe lirc_i2c %chmod 664 /dev/lircd %lircd
We will now test the remote control using irw.
%irw
Point your control at your ir receiver and push a button (you did plug in the ir receiver that came with your card right? If not, shutdown your computer, plug it in, and start the computer again). The name of the button you just pushed should be displayed on the text screen. If it doesn't work, then there's something wrong.
We will now setup the remote control so that it will start whenever we turn on the computer. First, open up the modules file to be edited.
%vi /etc/modprobe.d/aliases
Add the following line above the 'ivtv' line that we added before.
'alias char-major-61 lirc_i2c'
Now we need to change permissions of lircd. First find out where lircd is.
%which lircd
This command will reveal a path. Enter that path into the following command
%chmod 555 /usr/local/sbin/lircd
Replace '/usr/local/sbin/lircd' with the path revealed by the 'which' command
Save your changes and exit the editor. Open up another important file.
%gedit /etc/udev/udev.rules
For the following information, I viewed the following website http://ubuntuforums.org/showthread.php?t=30612&page=2&highlight=lirc. Add the following line at the end of the file.
KERNEL=="lirc0", SYMLINK="lirc"
Need to download a script in order to get lirc to startup at boot time
%cd /home/mythtv/ %wget http://www.abarbaccia.com/mythtv/lirc
I did not create this script, and I don't know who did. If it was you, thank you VERY much.
%mv lirc /etc/init.d/lirc %chmod 755 /etc/init.d/lirc %update-rc.d lirc defaults 99
Restart the computer and login
%cd ~/Software/tv/pvr_firmware/remote_control/lirc*
Enter the irw command
%irw
Press some buttons on your remote control. If you get the right output, then it works. If not, something is wrong. Did you remember to plug in the ir receiver? Is your remote control supported?
Getting the remote control to work during Myth
%wget http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt %mv lircrc-haupgrey-g3.txt /home/mythtv/.lircrc %ln -s /home/mythtv/.lircrc /home/mythtv/.mythtv/lircrc
Restart the computer. Make sure to run the myth front end as the mythtv user or the remote control won't work. You may need to edit the .lircrc file. Do so by using gedit.
%cd /home/mythtv %gedit .lircrc
Use the irw program in a separate terminal to know what the output from the remote control is called. For example, if the output of irw is the following: 0000000017b4 01 Forward Hauppauge_350 then that button of the remote control is called 'Forward'. This string goes in the 'button' field of the relevant section of the .lircrc file. Identify the proper button to be used by Mythtv by viewing the myth documentation at www.mythtv.org. For example, if you want the 'Forward' button of the remote control to be used to advance 1 second, then you would use the '>' button. '>' would go in the 'config' field of the relevant section of the .lircrc file. Continue editing the file to suit your own needs.
MythTV finishing touches
For much of the following information, I visited the following website https://wiki.ubuntu.com/MythTV?highlight=%28mythtv%29. Set up the backend so that it starts upon boot up
Do this by adding a line to the /etc/init.d/mythtv-backend file
%gedit /etc/init.d/mythtv-backend
Add the following line in the file
HOME=/home/mythtv
Note: Do not add the quotes
Set it up so that the mythtv user doesn't use screen savers. Sysem->Preferences->Sessions Click the Startup Programs Tab Click the 'Add' Button Enter in 'xterm s off' Set its order as 199
Set it up so that the front end starts up automatically when you login as mythtv. Click the 'Add' Button Enter in 'mythfrontend' Set its order as 200.
You now have a myth system installed on your computer. To start myth, restart the computer. Login with the 'mythtv' username. Enter in the password you created at the beginning of this tutorial; you're watching Myth!
Myth Plugins
Myth DVD
Myth DVD allows you to watch DVD movies using myth, or import the DVD video into myth and watch it at a later time directory from your computer. There are several prerequisites to using Myth DVD. Very relevant information for displaying multimedia in Ubuntu can be found at RestrictedFormats. Please review the legal aspects of viewing multimedia described on that page. I take no responsibility for your actions. Perform the following.
sudo apt-get install libdvdread3 sudo /usr/share/doc/libdvdread3/examples/install-css.sh
Now restart your computer. After this, try inputting a DVD into your computer. Totem should come up automatically (Ubuntu 5.10 has Totem as the movie player that automatically starts when a DVD is input into your system). If Totem doesn't start up, and you would like it to automatically, then follow System->Preferences->Removeable Media and select the multimedia tab. The command for viewing DVDs when disks are inserted is totem %d. I found that the playing of the DVD was jerky on my machine. In order to resolve this, I had to enable DMA for the DVD player. I did this by performing the following as root user.
hdparm -d1 /dev/hdc
As long as I was installing the above, I found some other multimedia software that I wanted to install. apt-get install the following packages: flashplayer-mozilla, gftp, gstreamer0.8-plugins, gstreamer0.8-lame, gstreamer0.8-ffmpeg, mozilla-mplayer, and gnomebaker. In order to use Myth DVD, you must have first installed the plugin onto your computer. This is done using Synaptic Package Manager (described earlier in this document). If you haven't done it yet, first download Myth DVD (search in the myth* section of possible packages to download). Once you have it downloaded onto your computer, you need to give the mythTV user permission to use the CD and DVD devices. You can do this by executing the following set of instructions as root user.
Open the 'System' menu of Ubuntu. Follow this Path:
System->Administration->Users and Groups
Make sure the checkbox at the bottom of the window next to the words 'Show all users and groups' is checked. Now scroll down through the users until you find the mythtv user. Click once (select) the mythtv user; this should sensitize a properties button on the right side of the window. Click the properties button. Select the 'User Privelges' tab of the properties window. Here you are presented with options to allow the mythtv user to perform. I allow the mythtv user to use audio devices, the cdrom, the floppy drive, the video acceleration, and the modem. (I allow mythtv to use the modem in preparation of an additional feature. I'm told that mythtv can act as a caller ID, displaying the phone number calling in directly onto the television. I'm not positive this feature exists, but I hope it does, and I look forward to realizing that feature. I will update this HowTo with more information as I discover it.)
It is important to exit these windows by pressing the 'Ok' buttons. This will save the changes that you've made. You should be good to go. Start watching DVDs with your newly upgraded Myth Tv system! If it doesn't work, restart your system and try it again. If it still doesn't work, are you sure you have a DVD ROM and not a CD ROM?
So now you can watch a DVD. But what about ripping a DVD (copying the film from the optical disk to the computer). We will figure out how to do that now. Unfortunately, the mythDVD we downloaded doesn't come with the myth transcoding daemon compiled in. As the root user, perform the following:
wget http://www.abarbaccia.com/mythdvd_0.18.1-4_i386.deb dpkg -i mythdvd*
Restart your computer.
Relevant Links
Websites used to install Myth:
Most Important -> http://ubuntuforums.org/archive/index.php/t-2878.html
http://ubuntuforums.org/archive/index.php/t-8387.html
- This fault [1/1045] forced a configuration screen to pop up asking for username and password of sql.
http://mythtv.org/pipermail/mythtv-users/2005-February/076574.html
- Above site told me mythfilldatabase command
http://www.pvrguide.no-ip.com/bbs/index.php?showtopic=4654&st=40 http://www.abarbaccia.com/content/view/19/31/ http://www.abarbaccia.com/content/view/18/31/
- Says how to setup the remote
http://keeto.net/articles/mythtv_lirc_irman.html http://www.pvrguide.no-ip.com/bbs/index.php?showtopic=5076&pid=18277&st=0&#entry18277 http://www.parker1.co.uk/mythtv_ubuntu.php
Myth Daemon start automatically
Remote Control instructions
http://home.comcast.net/~alf_park/mythtv.html http://ubuntuforums.org/showthread.php?t=30612&highlight=lirc http://mythtv.info/moin.cgi/UbuntuInstallation
http://www.gossamer-threads.com/lists/mythtv/users/161275
Myth DVD