MythTV

From SME Server
Revision as of 15:21, 29 November 2008 by Christian (talk | contribs) (noting how to update ivtv-kmdl after SME upgrade)
Jump to navigation Jump to search

MythTV Backend

  Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.



  Warning:
As SME Server is designed as a secure system using minimal resources it does not contain a window manager like X. You should only run the backend of MythTV on your SME Server. You should watch TV on other workstations on your network.



  Note:
Future mythTV versions (any later then 0.20.2) will NOT work with SME Server 7.3 since MySQL version 4.1 is the default version with default SME Server 7.3 (MySQL updates not foreseen yet) and newer versions of mythTV *require* at least MySQL version 5.x.

ATRPM no longer has Myth 0.20.2 which is the last version that supported mysql4. Christian does have these rpm's and can make them available if you need them until SME server 8 is ready. Alternatively, and this is not recommended, you could upgrade to mysql5.

Also note that for the ivtv modules, that they do depend on the kernel version. You may be in a situation where the supported ivtv module depends on a kernel you do not have. Chances are over time, that the next SME update will provide the kernel you need. If you are in a hurry, you will need to update your kernel to a matching version. Do this only if you are confident in what you are doing and its impact.


Description

MythTV is a GPL licensed suite of programs that allow you to build the mythical home media convergence box on your own using Open Source software and operating systems.

HowTo backgrounds

A number of people have been struggling with this so I thought I would start to document what I did to get this working. It is cumbersome but do-able. I also strongly suggest you also use the sme server as a backend and don't implement the frontend on it as i have little confidence in the security of it.

I would suggest moderate and more expert users check this out first to see if I have some errors or holes. If it's close then we can update the wiki. I just didn't want to muck it up before some sanity was applied. In particular, I would like to see if there is any minimization we can do say by removing unnecessary steps or packages.

I had to draw on many sources including: Duncan's how-to (link currently dead); the contrib wiki; mythtv.org (and it's wiki); knoppmythwiki.org; and many more that I have forgotten.

Here goes and good luck.

(Thanks to Christian for this HowTo)

Please add your success/failure stories at the end of this HowTo.

Configure necessary repositories

To be able to install MythTV on SME Server you need to configure the ATrpms and the Dag repository as shown below.

ATrpms

The following command will configure the ATrpms repository on SME Server. ATrpms After adding it to the database we have to update the changes to the configuration file:

signal-event yum-modify

Dag

The following command will configure the Dag repository on SME Server. EDIT NOT COMPLETE!


To create an entry in the database for the epel repository we open put the following commands in a terminal window or in a shell window:

/sbin/e-smith/db yum_repositories set epel repository \

Name 'SME Server - epel' \
BaseURL 'http://<http://download.fedoraproject.org/pub/epel/7/$basearch' \
EnableGroups yes \
GPGCheck yes \
Visible no \
status disabled

To enable the changes:

    signal-event yum-modify

Just to be sure, give yum a fresh start:

    yum clean all

After adding it to the database we have to update the changes to the configuration file:

signal-event yum-modify

Installation

You will likely need the following (based on Duncan's How to). I know some are needed but have not confirmed if all are needed.I suspect some of it is only needed if you wish to load up the myth source and use their "config" tool.

Dependencies

There should be no further dependency requirements. The old requirements have been moved to the section "Old Page Contents", "Dependencies".

MythTV packages

  Note:
The exact kernel version used is depending on the processor(s). Multiple or HT processors will use the SMP kernel by default, otherwise the non SMP (.EL) kernel is being used.

Entering 'uname -r' on the console will tell you the exact kernel you are currently running, and using it with the yum command will make it easy to prevent typos and using the correct kernel version used by your machine. The ` sign in the below code is the one as on the ~ key, below the 'esc' key.


Note that as of MythTV 0.21, mysql 5 is required. Version 0.20.2 is the last version of mysql 4 which is what SME 7.x is using. Also note that your front end will need to match (for Knoppmyth 0.20.2 is in R5F27. For SME8 and later you can drop the -0.20.2 suffix.

yum install mythtv-themes-0.20.2 mythweb-0.20.2 mythtv-setup-0.20.2 mythtv-frontend-0.20.2 mythtv-backend-0.20.2 --enablerepo=atrpms --enablerepo=dag
yum install mythtv-docs-0.20.2 --enablerepo=atrpms --enablerepo=dag
yum install libmythavcodec-0.20.2 libmythavformat-0.20.2 libmythavutil-0.20.2 libmythfreemheg-0.20.2 libmythlivemedia-0.20.2 libmythtv-0.20.2 libmythui-0.20.2 libmythupnp-0.20.2 --enablerepo=atrpms --enablerepo=dag

Ensure the service will start properly on boot:

config set mythbackend service status enabled
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99mythbackend

To use a analogue Hauppauge PVR based card you should also install the ivtv packages so your card gets recognized and loaded:

yum install ivtv-kmdl-`uname -r` --enablerepo=atrpms --enablerepo=dag
yum install ivtv --enablerepo=atrpms --enablerepo=dag

To be sure that the drivers are loaded and to not leave SME Server in a unknown state issue the following command:

signal-event post-upgrade; signal-event reboot

MySQL

You will need to set up MySQL. The required mc.sql file is located in the documentation of MythTV. If you did not install all of the packages earlier in this How-to then the easiest way to retrieve this is by issuing this command:

yum install mythtv-docs-0.20.2 --enablerepo=atrpms 

This should normally install the mc.sql file that holds the database layout in /usr/share/doc/mythtv-docs-$version/database/

To load the database into MySQL import the dump file into MySQL, for the 0.20.2 version this would read:

mysql < /usr/share/doc/mythtv-docs-0.20.2/database/mc.sql

Now grant access to your box and remote front ends within subnet 192.168.1 (change to suit you) to access mysql

mysql -e "grant all on mythconverg.* to mythtv@'192.168.1.%' identified by 'mythtv'"
mysql -e "flush privileges"
/sbin/e-smith/config setprop mysqld LocalNetworkingOnly no
/sbin/e-smith/expand-template /etc/my.cnf
service mysqld restart

From the shell window of your front end, verify that the access worked (see also known problems):

mysql -h smeserveraddress -u mythtv -pmythtv mythconverg
  Note:
The address of your SME Server in above command should be either the IP address, 'localhost' or the full qualified domain name (FQDN) of your server.


If you have no error then quit. If you do then it is likely a permission or grant error to be resolved.

X11 Forwarding

You need to set up X11 forwarding to another machine (I targeted a CentOS release running on a virtual machine (VirtualBox) on my XP Home machine.

X11 Forwarding is described in the X11 Forwarding on SME section of this wiki.

You will then need to install two more packages, specifically:

yum install xorg-x11-font-utils xorg-x11-xfs
signal-event post-upgrade; signal-event reboot

If you would like to view the X11 output of your SME Server on another linux machine (which has X running) and do:

ssh -X root@smeserveraddress /usr/bin/mythtv-setup

and follow the instructions to set up your environment for the backend.

Startup mythtv

  • modprobe ivtv (check 'dmesg' for any errors. See this example of a correctly loaded PVR-350)
  • 'mythbackend -d' on the console will start mythbackend as a deamon
  • Make it all automagically at boot time
  • Make tv listings (mythfilldatabase) automagically

Updating after SME Upgrades

During certain SME Upgrades, you may need to update the drivers to match any new kernel versions. This is usually made obvious when your tuners disappear after an upgrade. If your tuners are still working then there should be no reason to update these drivers.

ivtv drivers

You should only have to install the new kmdl for ivtv using:

yum install ivtv-kmdl-`uname -r` --enablerepo=atrpms --enablerepo=dag

Installing Mythweb in an Ibay

(taken from the forums mainly donated by Duncan)

  • Create an Ibay (e.g. tvoverview, own admin, read everyone, enable html, access localnetwork without pass) Use any Ibay name you want, just make sure you use it througout the config consistantly. Also make sure you secure access to the Ibay either by SME Server default mechanism (password) or by using htaccess passwords.
  • Create custom template
# mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
# cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
# pico 99mythweb 

and paste following code into the template:

<Directory /home/e-smith/files/ibays/tvoverview/html>
    php_admin_flag      allow_url_fopen on
</Directory>
  • Allow .htaccess
# /sbin/e-smith/db accounts setprop tvoverview AllowOverride All
# /sbin/e-smith/signal-event ibay-modify tvoverview 
  • edit the mythweb .htaccess file and add
Options FollowSymlinks

and adjust the below variables to the right values valid for your mysql setup:

setenv db_server        "127.0.0.1"
setenv db_name          "mythconverg"
setenv db_login         "mythtv"
setenv db_password      "mythtv"

Towards the bottom of the file where it says "RewriteEngine on". Whilst in this file uncomment the line and make it look like:

RewriteBase    /tvoverview

Now access http://yourserver/tvoverview and you should be up and running.

Known problems

  • MySql

When you encounter the following error: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client' then you need to set the above mysql user password 'old' style. When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password. To do this, enter the following on the console:

mysql> SET PASSWORD FOR mythtv@localhost = OLD_PASSWORD('mythtv');

where user and password are the same as used with the 'grant' command. '/usr/bin/mythtv-setup' should start fine now.

  • Mythtv-Setup

There are problems reported that the main menu presented by mythtv-setup is present but not visible. If this occurs, menu choices will still work and the sub menu screens will appear properly. But you will need to make your top level choices by feel, memory, or some other reference.

MythTV Frontend

One of the easiest to install frontends for MythTV is KnoppMyth as there seems to be good support including HowTo's to link things together. For instruction on how to install Knoppmyth have a look at this HowTo.

Note if you are running mythbackend on SME 7 then you are using myth version 0.20.2 (per above) thus you will need a matching front end such as Knoppmyth R5F27. If you are using SME 8 you should be able to use the latest front ends as long as you updated to the latest backend above (ie. later than 0.20.2).

User experience

Users who have implemented this how-to should add their experiences as data points of success for others. Please sign your experience using four tildes (~).

  • Tested with SME Server 7.2 - Works (Christian 30 November 2007 (UTC))
  • Tested with SME Server 7.3 - Works (RequestedDeletion 2 January 2008 (UTC))

I decided to use Knoppmyth as my front ends as there seems to be good support including HOW-To's to link things together.

Install Knoppmyth from "http://www.knoppmythwiki.org/?id=KnoppmythDownloads" onto a front end PC.

Follow this HOW TO http://www.knoppmythwiki.org/index.php?page=FrontendOnlyInstall

I would also recommend defining a common file structure for your frontends and backends. I used the SME as my common file store. In theory, the next version of myth will allow you to more easily share directories but for now you will need to follow the following HOW-TO's

However, you won't have much joy using NFS (per their suggestion) and rather than samba you may wish to consider using sshfs as described in: http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/ After you make your mounts, adjust your directory structure in the myth frontend to suit your mount structure. - Christian 10:44, 2 December (MST)