Installing Mythtv on Fedora 6

From MattWiki

Mythtv Install on Fedora 6

Note Note: This is the Install Log for mythtv.mattrude.com built on May, 15th 2007

Build System Specs

This How-To was build with these specs.

Fedora Core 6 Mythtv 0.20a
Intel Pentium 4 3.0 Ghz 1.0 GB Ram
Seagate 80GB SATA Hard Drive Seagate 500GB SATA Hard Drive
PVR-350 PVR-500
IVTV 0.8.1 LIRC 0.8.1

Fedora System Install

On the Disk Partitioning Setup screen, choose to Manually partition with Disk Druid. A suitable custom partitioning setup is as follows:

Mount Point    Size         Format
/boot          100MB        ext3
swap           same as RAM  swap
/              10-12GB      ext3
/mythtv        The Rest     JFS or XFS

On the Package selection screen, uncheck all the check boxes and select the "Customize now" radio button. At the next screen, you'll be able to re-add the components we need/want. Minimally, add (at least) these package groups to those already selected:

   * Desktop Environments -> KDE (K Desktop Environment)
   * Applications -> Graphical Internet
   * Applications -> Sound and Video
   * Servers -> MySQL Database
   * Servers -> Web Server

Optionally, you might also want to add these groups:

   * Servers -> Windows File Server
   * Servers -> Network Servers -> vnc-server
   * Development -> Development Libraries
   * Development -> Development Tools

Firstboot Setup Utility

Firewall

For the easiest setup disable the firewall. If you would like to use the firewall you must open at lease these ports.

Port Number Service
22 SSH
80 WWW
3306 MYSQL
6543 MythBackend
6544 MythBackend

SELinux

Just disable SELinux at this step.

If you forget to disable it now, you can always disable it later by editing: /etc/selinux/config and setting "SELINUX=disabled" then you must reboot.

Date & Time

Set the Time Zone and Enable NTP (Network Time Protocol)

Create User

Add the user 'mythtv' with a password of 'mythtv'

Prep Work

Updating the System

WARNING: there's a nasty bug in the FC6 installer that will result in an i586 kernel, instead of an i686 kernel, getting installed on some 32-bit x86 systems. Any 32-bit x86 processor newer than a Pentium I, with the exception of some Via C3 processors, should be running an i686 kernel. You can double-check whether you've been bitten via the following command:

rpm -q --qf='%{name}-%{version}-%{release}.%{arch}\n' kernel

If you see i586, follow the directions in the Fedora wiki to remedy the problem: http://fedoraproject.org/wiki/Bugs/FC6Common

Now Update the system via yum

yum -y update

Since you will be most likely installing the latest Kernel when you do you update, reboot the system when the update is finished.

$reboot

Add the mythtv user Account

If you missed this set before you must add the mythtv account now.

As root run.

/usr/sbin/adduser mythtv
passwd mythtv

Set the password to be mythtv also

Setup Drivers & Repos

  • Download ATrpms and Freshrpms repos

Logged in as root and run

cd /etc/yum.repos.d/
wget http://dl.atrpms.net/all/atrpms-package-config-115-3.fc6.at.i386.rpm
wget ftp.freshrpms.net/pub/freshrpms/fedora/linux/6/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm
wget http://rpm.livna.org/livna-release-6.rpm
yum -y localinstall *.rpm

(vi all the other .repo files and change pgp=0)

MYSQL

MySQL is needed by Mythtv to store ALL system settings. In order to access the database from a remote system you must confirm networking is setup in Mysql.

Installing MYSQL

If you missed installing Mysql during the install then you can install it now.

On Fedora the best way to install Mysql is via yum so run something like.

yum -y install mysql-server

You will also need some extra stuff for Mysql to run with Mythtv

yum -y install mod_auth_mysql libdbi-dbd-mysql php-mysql

Configuring MYSQL

First lets start Mysql and make sure it will start every time we start the system.

/sbin/chkconfig mysqld on
/sbin/service mysqld start

Now we need to set a password for the root account in Mysql. You will need to replace "NEW_ROOT_PWD" with the new password for the Mysql root user account.

Please note the ";" at the end of all SQL statements

mysql -u root mysql
UPDATE user SET Password=PASSWORD('NEW_ROOT_PWD') WHERE user='root';
FLUSH PRIVILEGES;

Now you need to give the Mythtv user access to the database from the localhost.

grant all on mythconverg.* to mythtv@"localhost" identified by "mythtv";

If you have remote systems (or are planing any) also allow them to access the database.

grant all on mythconverg.* to mythtv@"%" identified by "mythtv";

When your done.

quit

Testing MYSQL

Since we have no data in the database yet all we can test is if mythtv (the Mythtv Mysql username) can access from both the local system and from remote systems.

Can Mythtv access Mysql?

mysql -u mythtv -pmythtv

Or from a remote system.

mysql -h <mythbackend> -u mythtv -pmythtv

Once you are in mysql to exit run quit

> quit

IVTV

IVTV is software for the Hauppauge Capture cards (PVR-150/250/350/500).

Installing IVTV

yum -y install ivtv-firmware
yum -y install ivtv-kmdl-`uname -r`.`uname -m`

Configuring IVTV

Next add the following to /etc/modprobe.conf

alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-81-1 ivtv

Testing IVTV

  • Now try loading up the ivtv driver
/sbin/depmod -a
/sbin/modprobe ivtv

Lets conferm that the video files have been built

ll /dev/vide*

Now lets test the input from our capture card

cat /dev/video0 > /tmp/test_capture.mpg
(ctrl-c to stop capture)

now lets see if you captured any video

mplayer -vo xv /tmp/test_capture.mpg

or to display on the PVR-350 try

mplayer -vo xv /tmp/test_capture.mpg

If you get something that looks and sounds intelligible, then congrats, your card is good to go! If not, and you're using the tuner input, it may be that you aren't tuned to a channel you actually have a signal on. Try this combo, which will let you watch the mpeg2 stream off the card while changing channels:

/usr/lib/ivtv/ptune-ui.pl &
mplayer -vo xv /dev/video0

If you have a problem try.

echo 16384 > /proc/sys/vm/min_free_kbytes
$reboot

Configuring IVTV for next reboot

echo "chown mythtv:mythtv /dev/vide*" >> /etc/rc.d/rc.local
echo "chown mythtv:mythtv /dev/radi*" >> /etc/rc.d/rc.local

LIRC

For the *new* PVR-150 with IR-Blaster you will need this patch

Installing LIRC

yum -y install lirc-kmdl-`uname -r`.`uname -m`
yum -y install lirc

After you have installed lirc you need to setup the port.

/sbin/depmod -a
/sbin/modprobe lirc_i2c 
/sbin/chkconfig lircd on

Configuring LIRC

If your using the Hauppauge Remote you can download the config file.

wget http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt
mv lircrc-haupgrey-g3.txt /etc/lircd.conf

Next Update rc.local

echo "/sbin/modprobe lirc_i2c" >> /etc/rc.d/rc.local

Setup the lircrc convert file

add the /etc/lircd.conf

Make sure to run this step as the user you are plaing on useing the mythfroned with. Make the lircrc file

mkdir /home/mythtv/.mythtv
vim ~/.mythtv/lircrc

Copy Paste this into the lircrc file Then Restart Lircd

/sbin/service lircd start

Mythpowerbutton

as mythtv run

vim /usr/local/bin/mythpowerbutton.sh

Copy & Paste this box into the file

#!/bin/bash
PROG=mythfrontend
STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'`

if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
    if [ $STATUS -eq 0 ]
    then
        ( $PROG & )
    else
        killall $PROG
    fi
fi
exit 0

Testing LIRC

  • Test to see if irw can read your remote
/usr/bin/irw
  • Now start pressing buttons on your remote control and see what happens.

Mythtv

CPAN

As root run. cpan

  • hit enter for all the questions until it asked about the PREFIX and change that to the same as the mythtv prefix then continue until you get the the prompt.
  • at the prompt enter.
install Date::Parse
install Time::Format
exit

Installing Mythtv via yum

As root run.

yum -y install mythtv-suite

Now update the system

yum -y update

Update Mythtv from SVN

This is to bring your setup to the latest BETA Mythtv Software,

You May Skip This Part.

Also see the page on updating to Latest SVN and Building RPMS from SVN.

  • In order to get the latest updates of mythtv, download and install them from source.
cd /tmp/svn
svn co http://svn.mythtv.org/svn/branches/release-0-20-fixes/mythtv
svn co http://svn.mythtv.org/svn/branches/release-0-20-fixes/mythplugins
svn co http://svn.mythtv.org/svn/branches/release-0-20-fixes/myththemes

Now lets update the system one last time

yum -y update

There are a number of development libraries and packages required to compile MythTV. The following commands should obtain them all.

yum -y install gcc-c++ freetype-devel lame-devel qt-devel mysql-devel lirc-lib-devel subversion ncftp
yum -y install mesa-libGLU-devel libXv-devel libXxf86vm-devel libXmu-devel qt-MySQL libXvMC-devel kdelibs-devel

Run the following to get the myth plugin dependencies

yum -y install faad2-devel fftw2 fftw2-devel libid3tag libid3tag-devel  flac-devel libtiff-devel taglib.i386 taglib-devel.i386
yum -y install libcdaudio-devel SDL-devel cdparanoia-devel libexif-devel libmad-devel fftw3 fftw3-devel libvorbis-devel \
perl-XML-Simple perl-Image-Size perl-TimeDate.noarch
wget ftp://ftp.pbone.net/mirror/reb00t.com/fedora/6/perl/perl-Time-Format-1.02-1.n0i.2.noarch.rpm
yum -y localinstall perl-Time-Format-1.02-1.n0i.2.noarch.rpm
  • update qmake
ln -s /usr/lib/qt-3.3/bin/qmake /usr/bin/qmake
  • In order to find all the libs run
echo "/usr/local/lib/" >> /etc/ld.so.conf
/sbin/ldconfig
  • Remove all the rpm you just installed
rpm -qa | grep myth | xargs rpm -e
  • Now reinstall mythlib so yum will keep it updated
yum -y install mythlib

Compile & Install Mythtv

Run the following line by line & look for errors.

cd /tmp/svn/mythtv
make distclean
./configure --prefix=/usr/local --with-bindings=perl --disable-firewire --disable-dbox2 --disable-hdhomerun
qmake PREFIX=/usr/local mythtv.pro
make
/sbin/service mythbackend stop
make install
cp etc.sysconfig.mythbackend /etc/sysconfig/mythbackend
cp etc.rc.d.init.d.mythbackend /etc/rc.d/init.d/mythbackend
chmod a+x /etc/rc.d/init.d/mythbackend
echo "/usr/local/lib" >> /etc/ld.so.conf

Compile & Install MythPlugins

cd /tmp/svn/mythplugins
make distclean
./configure --prefix=/usr/local --enable-faad --disable-mythbrowser --disable-mythflix --disable-mythgallery \
--disable-mythgame  --disable-mythnews --disable-mythphone --disable-mythweather
qmake PREFIX=/usr/local mythplugins.pro
make
make install
rm -rf /var/www/html/mythweb
cp -r mythweb /var/www/html/
chown -R apache:apache /var/www/html/mythweb

Compile & Install MythThemes

cd /tmp/svn/myththemes
make distclean
./configure --prefix=/usr/local
make
make install

Configuring Mythtv

In order for mythbackend to create a pid file when the daemon is started you will need to change /etc/rc.d/init.d/mythbackend and add some lines

vim /etc/rc.d/init.d/mythbackend
  • change the user to mythtv
  • change the log file to /var/log/mythtv/mythbackend.log
  • add -p /var/run/mythbacken.pid to the end of the daemon command.

Once you have saved the file then.

  • create & setup the log directory
mkdir -p /var/log/mythtv
chown mythtv:mythtv /var/log/mythtv
  • setup the run directory
chmod 777 /var/run/
  • setup the /dev/video & /dev/radio files
chown mythtv:mythtv /dev/video*
chown mythtv:mythtv /dev/radio*
  • get mythbackend to start when the system starts
/sbin/chkconfig mythbackend on
/sbin/service mythbackend restart

DataDirect

You must have an account with Zap2it in order for Mythtv to download the correct program data for your setup. If you do not have an account with Zap2it then go to http://labs.zap2it.com/ and choose "New User? Sign-Up" link, to setup a new account. If you have more then one video input source (CableTV and OTA-TV on the same setup) you need a different account fore each source.

The DataDirect 'certificate code' for MythTV is ZIYN-DQZO-SBUT

Once you have your account(s) setup with Zap2it, you may start Mythtv-Setup

Mythtv-Setup

As mythtv run.

mythtv-setup

Currently there are 6 (six) category's in mythtv-setup. The six category's are:

  • General - The General category is for the Mythbackend settings. It has options like 'number of concurrent jobs per server' and Startup and Shutdown options.
  • Capture Cards - Is the only location in Mythtv that you setup your capture cards. If you have more then one card in your system then you need to add all of them here in this section.
  • Video Source - Video Source is where you add you zap2it account info, so therefore your cable or satellite TV providers information.
  • Input Connections - Here you tell Mythtv what Capture Card it will use with what Video Source. Since you just setup your cable or satellite TV providers information with zap2it and added your zap2it account information to the Video Source screen now you just need to select the correct providers for each input. If you only have one provider but more then one capture card then choose the same provider for each of the capture cards.
  • Channel Editor - This screen allows you to change the name of a channel or even make it so it will not be seen in your guide.
  • Storage Groups - When Mythtv records a show it needs to know where to put it. you can add more then one directory to each storage group and you can add more then one storage group per system.

MythFillDatabase

Mythfilldatabase will update the TV listings from Zap2it (DataDirect). You must have an account with zap2it in order for Mythtv to download the correct program data for your setup. If you do not have an account with Zap2it then go to http://labs.zap2it.com/ and choose "New User? Sign-Up" link, to setup your new account. If you have more then one video input source (CableTV and OTA-TV on the same setup) you need a different account fore each source.

The DataDirect 'certificate code' for MythTV is ZIYN-DQZO-SBUT

Once you are signed up with Zap2it then you must enter you account infomation into the "Input Connections" section of Mythtv-Setup. MythFillDatabase will not find any shows if this info is not enter into Mythtv-Setup.

As the user mythtv add the following line to the crontab.

As mythtv run

crontab -e

Then add...

01 10 * * * sleep $(expr $RANDOM \% 14400) && /usr/local/bin/mythfilldatabase > /var/log/mythtv/mythfilldatabase.log 2>&1

Then confirm the directory is there and setup As root run

mkdir -p /var/log/mythtv
chown mythtv:mythtv /var/log/mythtv
chmod 777 /var/log/mythtv

For More Information see: Zap2it, Mythfilldatabase, or DataDirect

Adding Channel Icons

To install the Channel Icons in Mythtv go to ./contrib/master_iconmap, and run:

./channel_icons.pl --icon-dir /mythtv/icons --find-missing
             <--  OR  -->
./channel_icons.pl --icon-dir /mythtv/icons --find-missing --rescan

The Script will then ask you if the channel it believes is the your channel is correct (It will walk throw all your channels). Once it's done with that your good to go and all your channels will show in mythweb and on the Guide.

For more information see: Channel Icons


Configuring Cron

As the root user add the following to the cron table via crontab -e

0 5 * * * /tmp/svn/mythtv/contrib/optimize_mythdb.pl > /dev/null 2>&1

MythFrontend

See: MythFrontend

MythWeb

See: MythWeb

MythStream

See: MythStream

XScreenSaver

See: XScreenSaver

For the user that will run the Mythtv-Frontend (mythtv), you need add .xscreensaver to the home directory of the user.

vim /home/mythtv/.xscreensaver

Now add the following lines.

timeout: 5   (Start the screen saver after 5 mins)
no-lock-mode (Do not lock the screen when the screen saver is running)

Other Resources