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, but this is really only valid if you're reading this HOWTO on the very first day that a new release has been made, because the tarball is a static file and won't include any fixes for issues discovered after the tarball was created.

The recommended solution is to download the source using subversion to ensure that you've got the latest fixes.

When using subversion, there are some other choices that need to be made:

- Do you want to run the stable release of MythTV? If yes, download from the "release-0-22-fixes" branch.
- Do you want to run the absolute latest developer code? If yes, 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. The latest code will be in "trunk".

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).

## 5.1 Configuring the Schedules Direct service

Schedules Direct is a non-profit organization which has licensed Television program data from Tribune Media Services and makes 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.2 Manually building MythTV

If you are going to use subversion, execute the following instructions to obtain the latest trunk version of MythTV.

To use the release version, you can execute the following. You are strongly encouraged to use the release version.

> `

>     $ svn co http://svn.mythtv.org/svn/branches/release-0-22-fixes/ mythtv-0.22
>     $ cd mythtv-0.22

> `

To download trunk:

> `

>     $ svn co http://svn.mythtv.org/svn/trunk/ mythtv-trunk
>     $ cd mythtv-trunk

> `

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.22 release and you originally obtained it using svn, you could enter the mythtv-0.22 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.22 code.

If you are using the tarball, then unpack it:

> `

>     $ tar -xjf mythtv-0.22.tar.bz2
>     $ cd mythtv-0.22
>     $ ./configure

> `

If you wish to change options, run ./configure --help to see what is available and to override any 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.

Once the compile is done, switch to superuser:

> `

>     $ sudo bash
>     # 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 and requires PAM version 0.79 or above. 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 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, do the following 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 internal 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.

Next Previous Contents