Install MythTV Backend

The majority of the rest of the work should be handled by Ubuntu packaging.

The backend will need to have mysql-server installed as well as mythtv-backend. Mythtv-backend doesn't depend on mysql-server since the mysql server can be located elsewhere on your network. Also, if this is a secondary backend, don't install mythtv-database or mysql-server. Just configure this backend to connect to the master backend instead.

  1. Install mysql and backend software
    • sudo apt-get install mysql-server mythtv-backend mythtv-database
  2. Behind the scenes, a mythtv user will be created in PAM as well as mysql. The database will be installed into mysql and the initial configuration performed. A mythtv group will also be created. Any user that will be configuring mythtv or running mythtv needs to be placed in this group.
    • You will be asked for the password to the root account of mysql. By default, there is no password.
  3. Next, add yourself and any other users that need MythTV acces to the mythtv group.

    • To add users to the mythtv group, use this command:

    # sudo usermod -a -G mythtv USERNAME
    • Where USERNAME is the name of the user you are adding to the mythtv group.
  4. VERY IMPORTANT: If you do not add your main user account to the mythtv group, you will get the dreaded database errors when you run mythtv-setup! For the addition to the group to take effect, a fresh login needs to occur-- so log out of your current session and then log back in right now.

  5. Next, you need to edit the mysql configuration to allow outside hosts to connect:

    $ sudo nano /etc/mysql/my.cnf

    Look for the line that reads:

    • bind-address=

    and comment out that line by placing a # at the beginning.

    Then, restart mysql:

    $ sudo /etc/init.d/mysql restart
  6. Backend Configuration: mythtv-setup

    mythtv-setup will not work on the local console, as it requires an X server for graphics, etc. If you must run it from the backend, you will need to install a windows server on the local machine. This is not recommended, as it is a waste of resources for this machine's given tasks.

    Run the following command from a remote terminal that is running an X server-- being sure to substitute your user name and the correct address of the backend machine:

    # ssh -X username@ /usr/bin/mythtv-setup

    If you encounter any problems connecting to the database, see the permissions troubleshooting guide: Troubleshooting

    After selecting your Language, you will be presented with the:

    Initial configuration page


    The initial configuration page will present you with 5 options. It is strongly recommended you follow these in order the first time you configure a backend installation.


    The general section is where you will set up the major information related to the master backend, job scheduling, and default locale information. It is setup in a sequential design with Back and Next buttons.


    The first screen of the General configuration deals with IP addresses of the backend system that you're running mythtv-setup on. If you are setting up only one backend/frontend installation, then the default values are fine and you can move to the next page by pressing the enter. If you need to move around the screen, use the arrow keys to move focus between settings.

    The default value shown on install will be, which is the internal loopback for the local machine. If you plan on deploying multiple backends, running mythweb from another computer, or if your backend is on one system and you're running the frontend on another machine then do not use the "" IP address. Set this to the ip address of this backend as recognized by other machines on your network. If you are using a router on your network that only hands out dynamic addresses, you might consider setting up this machine with a static IP address instead.

    NOTE: If you modify the address and use a "real" IP address, you must use real IP addresses in both fields, otherwise your frontend machines will generate "Unexpected response to MYTH_PROTO_VERSION" errors.

    Changing any of the port settings is very strongly discouraged. (If you do accidentally change them, the defaults are 6543 for the master/backend server, and 6544 for the HTTP requests)

    Once you're satisfied with the values, move the focus down to Next and hit Enter.


    The next screen details the Host-specific Backend setup. This is where you will set the specific directory path for this particular backend.

    As long as you setup a separate partition for /var/lib during the initial setup, the default option here - /var/lib/mythtv will work fine. If you setup a different mount point or won't be recording with this machine, be sure to set this accordingly. (Also, if you used a non-default location, be sure and set the ownership and permissions to match /var/lib/mythtv.)

    If for some reason you chose a file system other then XFS or JFS for this partition, choose to delete the files slowly. This will avoid some nasty bugs related to using ReiserFS or ext3.


    The Global Backend Setup screen will change settings that affect all backends.

    Your TV standard should be determined based on your locale. US users should choose NTSC. European users should chose PAL

    The VBI Format is used for closed captioning.

    The channel frequency table is also based on your locale.

    US and Canadian users using SchedulesDirect can skip the time offset for xmltv listings. International users will need to set this appropriately so that their data matches up at the correct time.


    The EIT scanner is used to gather data on the fly. If you have a DVB based source or a source providing this data, you will configure it here


    The Shutdown/Wakeup options are used for suspending or shutting down the backend server when it has been idle for the set limit. You can configure the master and/or secondary backend(s) to go into a sleep, suspend, or shutdown mode when not in use- depending on the capabilities of your motherboard.

    There are different methods you can use to accomplish this. A tutorial on ACPI wakeup/shutdown can be found on the ACPIWake page. You should complete MythTV installation and ensure the backend is properly functioning before trying to set up this function.

    If you only have one backend, the default values are fine and you can move to the next page by pressing the enter. Setting up more than one backend is beyond the scope of this guide -- see the mythtv documentation.


    WakeOnLan is another method of configuring secondary backends to wakeup.

    If you only have one backend, move to the next page. Setting up multiple backends is beyond the scope of this guide -- see the mythtv documentation.


    The Host Specific Job Queue sets up the types of jobs that are allowed to run on this machine. If you have multiple backends, you can configure certain backends to only handle particular types of jobs. This is especially useful if some are much more underpowered then others.

    It isn't recommended to have more then 2 simultaneous jobs running on any backend at any given time.

    The default job queue frequency of 60 seconds is adequate and doesn't need to be changed typically.

    Unless this backend is dedicated to only Transcoding/Commercial flagging jobs, don't change the CPU usage. Anything set higher then "Low" may jeopardize the ability to record programs due to being starved for IO/CPU usage.


    The Global Specific Job Queue sets up things affecting any and all backends on a mythtv network.

    If you don't check "Run Jobs only on original recording host", each of the jobs will be evenly distributed against possible backends. This will lessen the load on each machine.

    A decently powered backend with hardware encoding cards (1Ghz+) should be able to flag commercials at the same time as the recording is going. This helps if you ever plan to time shift your recording viewing by 10 or 20 minutes and want to have the commercials flagged as you watch.

    Typically you won't want to run your transcode jobs before commercial flagging. The idea should be that you will flag commercials, verify they are right and manually queue them up to be transcoded and removed. If you have a particular reason to transcode first, check this box.

    If you set up the backend to save the original files after transcoding, these will not be automatically deleted, but rather fill up your recordings directory with .old files. You will have to manually go in there and delete them to free up recording space as necessary.


    Thee Job Queue page provides an area to add your own scripts to perform on recordings.

    Some ideas for additional things can range from scp'ing a recording somewhere, transcoding it to fit on an ipod and copying it to a directory, or running it through a denoising filter.

    Capture Cards

    The capture cards section will list all capture cards setup locally on this backend.


    The initial capture cards page will list all cards in this backend.

    Choose "New Capture Card" to begin and add your tuner(s)

    If you need to reset the order of the tuners recognized, you can either delete these capture cards, or all capture cards in the mythtv network from this screen.


    When choosing a capture source, it's important to choose the correct type

    A very common error is when choosing the Hauppauge PVR Cards. There is an option for MPEG-2 Encoder Card (PVR-X50, PVR-500) as well as for standard V4L card. Be sure to choose the MPEG-2 encoder option here if you use a Hauppauge card.

    Each of the different types of sources has several options available to it.

    If you are confused about any of the options, see the mythtv documentation, mailing list, MythTV wiki, or LinuxTV wiki.

    If you are configuring a firewire connection, settings can be found on the MythTV Firewire Page

    Video Sources

    Video sources section will list all video sources in use for the mythtv database. The video sources will be configured to connect to the listing service you are using- either Data-Direct or XMLTV


    Video Sources is where to configure your program listing services


    Provide your video source with a logical name here. Its a good idea to provide detail now, because later you may end up adding more tuners, digital cable, satellite, etc :)

    If you are in North America, choose North America ( Anywhere else will need to use XMLTV setup.

    For SchedulesDirect, enter the username and password you obtained during registration. Retrieve the lineup and choose your option.

    If this input has a different frequency table then the rest of your global settings, set the particular setting here.

    Press Escape to go back to the main page from here.

    Input Connections


    The input connections page allows you assign any Video Sources to Inputs on your capture sources before.

    Choose the particular input you will need to assign and press enter


    Again, it's a good idea to provide a name for your Input here. Later on, if you have a tuner not working, it's easier to debug if it says "Digital Cable" in the frontend and then doesn't work.

    Choose the Video source associated with the input here.

    If you need to use an external channel changer script (firewire, serial, IR), you will need to enter the name of the binary/script that needs to be launched here. See MythTV_External_Channel_Changer for more information.

    If you are using a static channel listing, fetch channels from your listings source. If you are using something that scans on the fly via EIT or OTA HD, scan for the initial channels.

    Channel Editor

    The channel editor isn't necessary for the inital setup. You can safely ignore it for now, but remember to come here if you need to modify transports, change channel numbers, or delete channels .


    The listing of all channels is at the top of the screen.

    Warning: the delete channels button deletes ALL channels. If you want to delete just one, choose it in the list and press the delete key.

    If you need to repeat a scan for any sources already setup, you can do so here.

    If your DVB trasports are messed up, you can adjust them in the Transport Editor.

    When you are done making changes, exit mythtv-setup.

  7. Filling the Database

    The last step before starting the backend, is to fill the database with program guide data.

    # sudo mythfilldatabase

    Depending on the number of channels, the server load and the speed of your internet connection, this may take a few minutes.

  8. Start the Backend Server

    When The database fill is complete, the backend will automatically restart. Check to be sure it is running and that it started correctly:

    To check that the backend in now running:

    $ ps -p `cat /var/run/mythtv/`

    If you don't see output like:

    •   PID TTY          TIME CMD
      30711 ?        00:00:00 mythbackend

    then there was an error.

    Next, check the backend log file for obvious errors:

    $ more /var/log/mythtv/mythbackend.log

    Also, see Troubleshooting for more help.

MythTV/Install/Server/Backend (last edited 2008-06-27 10:15:11 by localhost)