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.
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.
You need to activate the ATrpms reposity before installing this contrib.
You need to activate the Dag reposity before installing this contrib.
see dag repository
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.
There should be no further dependency requirements. The old requirements have been moved to the section "Old Page Contents", "Dependencies".
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
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
If you have no error then quit. If you do then it is likely a permission or grant error to be resolved.
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.
- 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.
You should only have to install the new kmdl for ivtv using:
yum install ivtv-kmdl-`uname -r` --enablerepo=atrpms --enablerepo=dag
Configured as a Slave Backend
An alternative to using the SME Server as a Master Backend is to configure it as a Slave Backend to another Mythtv Master Backend Server. There are many ways to organize this and the reader should review the MythTV documentation to determine how they wish to implement it.
An advantage to using the SME Server as a Slave Backend is that a delegated Master Backend can house most of the enhanced functionality including mythweb, MySQL5, and a variety of plugins while keeping the SME Server implementation minimalist.
In my case I run the Master Backend as a Guest application in VMWare running on SME Server. This allows MythTV to run autonomously and I use the SME Server OS only to manage the video capture cards.
The reader should become familiar with MythTV's architecture before implementing this. In essence the steps are as follows:
- Configure Master Backend
- Configure Video Sources on Backend
- Install Mythtv per above Installation instructions EXCEPT for MySQL step. MySQL will run on the master backend.
- Make the needed config changes noted below
- configure needed shared mount points so Master, slave, and frontends all have the same path to shared directories.
- Run Mythtv-setup pn SME Slave as per X-11 Forwarding instructions above
- Under General Settings validate that the IP Address of the Master Backend is correct and that SME's address is defined for this server
- Define capture cards
- Slave Backend should pick up the Video Sources from the Master Backend automatically
- Configure the Input Connections
If there are situations where the Master Backend will come up after the Slave then you will need to kick the slave to restart mythtvbackend when the master comes back on line. This may be a polled mechanism on the slave using cron (such as is used in MythDora). Or it may be an explicit command given by the master when it starts up.
The main change is to have Mythtv on the SME Server look for the database on the master backend. This change is made in the mysql.txt file and is usually located in any of:
/var/lib/mythtv/mysql.txt /root/.mythtv/mysql.txt /home/mythtv/.mythtv/mysql.txt
If you followed the above How-To, it should be in the first one. This change is important otherwise you will get bizarre failures where the Slave sees the Master but not the other way around.
Change the first line "DBHostName=xxxx" so that xxxx is the DNS name or IP address of the master backend
Enable Master to wake up Slave
If the Slave starts before the master then it will not find the database and mythbackend will terminate. These instructions show you how to use the Master to wake up the slave. An alternative would be to have the slave poll for mythbackend not being active and attempt to revive it periodically.
First you will need to give the master authority to log in to the slave. This can be accomplished by following the SSH Key Howto at http://wiki.contribs.org/SSH_Public-Private_Keys. Specifically steps: http://wiki.contribs.org/SSH_Public-Private_Keys#On_SME_Server and http://wiki.contribs.org/SSH_Public-Private_Keys#Installing_the_Private_Key_onto_the_Clients
You can do this to allow the master's root user to log into the slave's root user. Test that it works by executing from the master "ssh slaveAddress". If you did it correctly, no password will be required.
Next you will want to create a script in a directory readable by the mythtv user but only writable by root. For example /root. The script (call it SlaveRestart) will contain
ssh root@SlaveAddress /etc/init.d/mythbackend restart
ensure the file is owned by root exclusively and has only read/execute permission for mythtv. Example:
chown root:root SlaveRestart chmod 555 SlaveRestart
Next is to modify /etc/sudoers. You will need to temporarily allow root permission to write this file.
chmod u+w /etc/sudoers
edit the file and add ",/root/SlaveRestart" to the end of the list of "mythtv" allowed commands. Remember to remove write permission on the file:
chmod u-w /etc/sudoers
Now, running mythtv-setup on the master backend, enter the "General" settings and advance to the "Shutdown/Wakeup Options" page. In the field "Startup Command:" enter "sudo /path/to/SlaveRestart".
You can verify that it works both from the command line of the master running as mythtv and by terminating the mythtbackend on the slave, restarting the mythbackend on the master, verifying the slave's mythbackend restarted successfully.
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
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:
Now access http://yourserver/tvoverview and you should be up and running.
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.
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.
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).
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))
- Upgrade from 7.3 to 7.4 Tested - Works - Note you may have to update your tuner card drivers (Christian 14:26, 29 November 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)