HOWTO: Setup Mythtv
These instructions assume you are root, if you are not, su to root, or research the sudo package.
As always with Gentoo, make sure portage is synced (but only if it's been more then 24 hours from the last time you synced. Please be nice to the rsync servers!):
First we need to make sure QT-3 was compiled with MySQL support:
emerge -pv =x11-libs/qt-3*
If you see -mysql on the line, we need to add MySQL (and other handy flags) support to qt:
echo "x11-libs/qt mysql opengl" >> /etc/portage/package.use
emerge -1 tells it to re-emerge qt without touching the world file, so it won't change anything, just rebuild itself in place:
emerge -1 =x11-libs/qt-3*
When you just installed Qt for the first time, don't forget to update your environment, otherwise you could run into compiler errors with MythTV:
env-update && source /etc/profile
We should now take a look at the MythTV flags:
emerge -pv --nodeps mythtv
You will likely want to add some support, I recommend
echo "media-tv/mythtv alsa opengl vorbis dvb dvd ieee1394 lirc mmx xvmc xv" >> /etc/portage/package.use
This will build myth with all of the common features.
if you don't already have VIDEO_CARDS set in your /etc/make.conf, you might want to set that, as newer X.Org versions have moved to that style.
We now emerge MythTV:
emerge -av mythtv
Compiling MythTV will take a fairly long time, even on a fast machine. Probably about the same time it takes for QT to compile.
Before we emerge xmltv we have to emerge some dependencies:
After that we need Term::ReadKey perl module:
You may now need to install XMLTV to retrieve TV listings over the Internet:
emerge -av xmltv
(MythTV users from outside the US or Canada, learn how to configure XMLTV to get a localized guide).
MythTV should now be installed and ready to configure.
Setting up the initial database
This step is only required on the system maintaining the database, which may or may not be one of your MythTV boxes. If the database is on a non-MythTV machine you'll need to copy the mc.sql file to it.
Run the initial setup:
Start the MySQL server and add mysql to the default runlevel.
Add it to startup
rc-update add mysql default
Set a root password:
/usr/bin/mysqladmin -u root -h localhost password 'new-password' -p
Now set up the database used by MythTV.
mysql -u root -p < /usr/share/mythtv/database/mc.sql
This command tells the MySQL server to login as root (-u root) and ask for a password (-p: only use if you have set a password as recommended). Then, the commands listed in the file are executed. You can
cat the file to see what is in it.
Also, note that MySQL keeps logs of all database transactions in /var/lib/mysql/. Over the course of a few years, these can really add up. It's useful to have these deleted after a small interval by adding the following to /etc/mysql/my.cnf under the section heading "[mysqld]":
expire_logs_days = 7
This will delete logs older than seven days.
Before running mythfilldatabase below you will need to start the backend server. If you don't, you won't be able to watch TV and will get errors like "Unable to connect to backend server".
Also, set up mythbackend to start on boot.
rc-update add mythbackend default
As a normal user, run:
Answer yes to both questions on the initial run.
Sign up for a Zap2it Account for the North America (DataDirect) under the Video Sources option. The certificate code is ZIYN-DQZO-SBUT
While in setup make sure to select the proper cards and so forth. (Note: mythsetup will take over the full screen and swallow the mouse cursor. Use the left/right arrow keys and the spacebar to navigate the setup screens.)
A useful tip is to use the --geometry option when running mythsetup, this prevents mythsetup from taking over the whole screen.
$ mythtv-setup --geometry 640x480
Add any users that will be using MythTV to the video group or you will not be able to use your capture cards.
# gpasswd -a <username> video
You may need to run this if you are having trouble:
# chmod 660 /dev/nvidia*
Be sure to associate your tuner card with a tuner in step 2. In step 3 configure the channel data. In step 4, associate your tuner in step 2, with the channel data in step 3.
If during step 3 you're finding that you're having problems receiving your channel lineup, you may want to do this:
# echo "net-misc/wget ~x86" >> /etc/portage/package.keywords # echo "net-misc/wget ssl" >> /etc/portage/package.use # emerge -v wget
where ~x86 is your real arch. This is because MD5 is required for auth on zap2it's SOAP stuff.
First fill the database with all the needed channel info.
If you run into these sorts of errors:
Resolving datadirect.webservices.zap2it.com... 18.104.22.168 Connecting to datadirect.webservices.zap2it.com[22.214.171.124]:80... connected. HTTP request sent, awaiting response... 401 Unauthorized Authorization failed.
Go back and make sure you have have a Zap2It account and that you entered your information correctly during mythsetup.
If you have MythTV set up to run mythfilldatabase automatically and use XMLTV, you may need to link your XMLTV configuration file to somewhere where the automated script can find it.
# ln -s /home/mythtv/.mythtv/*.xmltv /etc/mythtv/.mythtv/
The frontend can use real-time scheduling for the video output thread. To enable this you need a kernel >= 2.6.12 and >= sys-libs/pam-0.79. Add the following to
* - rtprio 0 * - nice 0 @audio - rtprio 50 @audio - nice 0
Run mythfrontend and see if it works, if it does myth is installed.