Next Previous Contents

5. Downloading and compiling.

Get MythTV from the http://www.mythtv.org web site. There are two installation methods you may choose from. The first is to download the latest release in tarball format and compile. The tarball release of MythTV should work on a wide variety of systems and should be the preferred method for new users. If you wish to use the subversion copy of MythTV you may obtain it from http://svn.mythtv.org

NOTE: If you are going to use subversion to compile MythTV rather than using the distribution tarball, you must join the http://www.mythtv.org/mailman/listinfo/mythtv-commits/ and http://www.mythtv.org/mailman/listinfo/mythtv-dev/ mailing lists to keep up to date with the current status of the code. Code obtained from subversion has no guarantees regarding stability, etc.

If you are in North America you will use the Schedules Direct grabber which is built-in to MythTV. You do not need to install XMLTV (so you may skip XMLTV-related instructions), but you need wget version 1.9.1 or higher.

Get XMLTV from http://xmltv.sourceforge.net. Download the latest version (0.5.51).


NOTE for Mandriva users:  If you have added a "PLF" mirror, you may skip the
next step and type:

# urpmi libmp3lame0 libmp3lame0-devel

After downloading, be sure to install both:
# rpm -Uvh lame*

Get lame from http://lame.sourceforge.net/. Download the source code to v3.96.1 by following the links from "Using" through "Download...".

5.1 Building LAME

Open a shell and switch to the directory where you saved lame.

$ tar -xzf lame-3.96.1.tar.gz
$ cd lame-3.96.1
$ ./configure
$ make
$ make test
$ su
# make install
Check that it worked:
# ls -l /usr/local/lib
-rw-r--r--    1 root     root       381706 Nov  4 14:22 libmp3lame.a
-rwxr-xr-x    1 root     root          674 Nov  4 14:22 libmp3lame.la*
lrwxrwxrwx    1 root     root           19 Nov  4 14:22 libmp3lame.so ->
libmp3lame.so.0.0.0*
lrwxrwxrwx    1 root     root           19 Nov  4 14:22 libmp3lame.so.0 ->
libmp3lame.so.0.0.0*
-rwxr-xr-x    1 root     root       360197 Nov  4 14:22
libmp3lame.so.0.0.0*

# exit
$ 

5.2 XMLTV

Red Hat Linux and Fedora Core:

RPMs for XMLTV and all of its dependencies can be obtained from http://ATrpms.net/name/xmltv/. The web page has a list of all the dependent packages you must download and install.

# rpm -Uvh xmltv* perl*

If you install from this location you may skip to Manually building MythTV.

Mandriva

RPMs for XMLTV and all of its dependencies are located in Mandriva's "contrib". If you have added a contrib mirror, try installing XMLTV:

# urpmi xmltv xmltv-grabbers
If this does not work, it is possible that contrib for your Mandriva version does not have XMLTV, so you may install the XMLTV prerequisites by typing:
# urpmi perl-xml-twig perl-xml-writer perl-datemanip perl-libwww-perl

and skip straight to the XMLTV compilation step.

Manual installation

Untar the xmltv file:

$ tar -xjf xmltv-0.5.51.tar.bz2
Install the xmltv prerequisites. The following prerequisites are the minimum required; when you actually start running the xmltv setup program it may alert you to other modules that are required.:

$ su
# perl -MCPAN -e shell
cpan> install XML::Twig
cpan> install Date::Manip
Date::Manip is up to date.
cpan> install LWP
cpan> install XML::Writer
cpan> exit

Change to the XMLTV directory and compile it:

$ cd xmltv-0.5.51
$ perl Makefile.PL
You can answer "N" to the tv_check, tv_pick_cgi questions. Say "yes" to the grabber required for your location.

You may get errors about modules not being installed. You will need to resolve any missing dependencies at this point, or your grabber may not work correctly.

$ make
$ make test
$ su
# make install
# exit

5.3 Configuring the Schedules Direct service

As of 2007-09-01, Tribune Media Services will no longer offer free guide data. Schedules Direct is a non-profit organization which has licensed the data to make it available to users of Freeware and Open Source applications.

If you wish to use Schedules Direct, you'll need to establish a user account. Go to http://www.schedulesdirect.org and click on the "Membership" link.

Once you've read and agreed to the Subscriber Agreement, Terms of Use and Privacy Policy proceed to the lineup choices and configure your account for your particular location and the channels that you have. This configuration will be imported into MythTV when you first run the mythtv-setup program.

5.4 Manually building MythTV

NOTE: Unless you are reading this documentation on the day that a new version of MythTV is released, it is highly encouraged that you use the "-fixes" version of the software and not the source tarball.

To download the release version, execute:

$ mkdir mythtv-release-0-21-fixes
$ svn co http://svn.mythtv.org/svn/branches/release-0-21-fixes/ mythtv-release-0-21-fixes
$ cd mythtv-release-0-21-fixes

See http://www.mythtv.org/wiki/index.php/Release_Notes_-_0.21.1 for release notes for MythTV v0.21.1

Execute the following instructions to obtain the latest version of MythTV. This is known as the "trunk" version and is considered the unstable code which is not guaranteed to work. Use of trunk implies that you are also reading the mythtv-dev and mythtv-commits mailing lists; failure to read those mailing lists can cause your system to stop working.

$ mkdir mythtv
$ svn co http://svn.mythtv.org/svn/trunk/ mythtv
$ cd mythtv

See http://www.mythtv.org/wiki/index.php/Release_Notes_-_0.22 for release notes for MythTV v0.22

NOTE: Using a svn version of the code allows you to stay up-to-date with changes. So, if there's an update to the 0.21 release and you originally obtained it using svn, you could enter the mythtv-release-0-21-fixes directory and type "svn up", which will update your copy with the fixed version from the website. You would then recompile and install the updated 0.21 code.

If you are using the tarball, then unpack it. Again, use of the tarball is only appropriate if a "-fixes" branch hasn't been created for the code that you're running.

$ tar -xjf mythtv-0.21.tar.bz2
$ cd mythtv-0.21
$ ./configure

If you wish to change options, run ./configure --help to see what is available and to override and automatically detected options. See the config.log file after running configure to see previous runs.

To compile:

$ make -j 2

The MythTV compile can take advantage of multiple CPUs, SMP and Hyperthreading. If you want to build MythTV on a multi-CPU machine (or with distcc), specify "-j numjobs", where "numjobs" is greater than 2. In the above example, we had two concurrent jobs executing, which is recommended for a single CPU system. Do not set the number of jobs too high, or your compile will actually take longer to complete than it would if you did a "normal" build.

If you are using distcc, and you had two other host machines (red, blue) participating, you would do something like:

$ export DISTCC_HOSTS='localhost red blue'
$ make -j 6 CXX=distcc

The actual speed-up, if any, is dependant on a number of factors, such as number of CPUs / hosts, etc. The distcc documentation recommends using a -j value of twice the number of CPUs available to keep all of them busy.

Some timing information. The following should only be used for illustration; your actual results may vary. The test involves a complete make distclean to the final binary.

  • P4 3.2Ghz HT: "standard" make: 12m 49s
  • P4 3.2Ghz HT: make -j 2: 11m 24s

In the above example, we see that with a single CPU, a multi-stage make does not significantly decrease compile time.

Once the compile is done, switch to superuser:

$ su
# make install
# exit

NOTE: subsequent configuration steps assume that you are within the MythTV directory that you cd'd to above.

Enabling real-time scheduling of the display thread.

MythTV supports real-time scheduling of the video output thread. There are three ways to go about enabling this: You can use rlimits, you can use the realtime security module, or on older systems you can SUID the executable. Enabling real-time scheduling is optional, but can make the video display smoother, especially if you are decoding HDTV.

rlimits

The rlimits method is the preferred method and is included in Linux 2.6.12 and above. Unfortunately, you need PAM version 0.79 or above, which may not be supported by your distribution yet. Assuming anyone running mythfrontend is in the audio group and rlimits are supported, all you need to do is place this in your /etc/security/limits.conf

*               -       rtprio     0
*               -       nice       0
@audio          -       rtprio     50
@audio          -       nice       0

realtime module

The second option is to use the Linux realtime kernel module. This is will be phased out over time, but is currently supported by many distributions that do not yet support rlimits. If you are not using the distribution kernel you must configure your kernel with:

Security options : [*] Enable different security models
Security options : [M] Default Linux Capabilties
You may also need to install the realtime module, using your distribution's realtime package. Assuming the users who will be running mythfrontend will be in the audio group you can get the GUID of a named group like so:
$ grep audio /etc/group
If the number printed out from the grep was 18, you can now load this module as root before starting mythfrontend:
# modprobe realtime gid=18

run as root option (not safe)

The final and least preferred option is to set the sticky bit on the mythfrontend executable. This opens a security hole, but is the only option on systems that do not support either rlimits or the realtime module. This does not work on modern distributions either, and is not recommended on any system connected to the Internet. This may also make it impossible to debug MythTV without running gdb as root. If you would still like to do this, you just need to run this as root:

# chmod a+s /usr/local/bin/mythfrontend /usr/local/bin/mythtv

Frontend-only configuration

Since MythTV uses a client/server architecture, multiple frontend computers can simultaneously access content on a Myth system. Live TV, watching and scheduling recordings, etc. are all possible from multiple frontends.

To get a better picture of what is needed to run a frontend, note the following:

  • You do NOT need the MySQL server installed on your remote frontend
  • You do NOT need XMLTV installed on your remote frontend
  • You do NOT need to run the mythtv-setup program on your frontend machine
  • Other than the exclusion of the MySQL server and XMLTV, the MythTV compilation procedure is the same as when you're setting up both a backend and a frontend. However, you will need to install the database access libraries.

    Once MythTV is compiled and installed:

  • Run the mythtv-setup program on your Master backend. Under the "General" menu, change the IP address of the current machine (by default, "127.0.0.1") to the real external IP address - 127.0.0.1 is the loopback address and no external machine can access it. Change the Master Server IP setting to the same IP address as well.
  • Run the mythfrontend program on your frontend machine, and a "Database Configuration" screen should appear. Set the "Host name" field to point to your Master backend's IP address.
  • 5.5 Gentoo

    Installation of MythTV on Gentoo consists of simply emerging the desired ebuild because all of the packages are now part of the official Portage tree.

    $ su -
    # emerge --sync # make sure portage is up to date.
    # vi /etc/make.conf
    
    Add mysql to your USE variable. i.e. USE="mysql ...."
    # emerge mythtv
    


    Next Previous Contents