MythTV - the install on Debian Linux

This guide is how I manage to install and afterwards having a running MythTV Mediecenter on a Debian Linux. This is a really great tool to have in the house - and use all around to end up with a really smart system - that even children kan use without problems. So this guide describes the install of the machines ( or Core and frontends ) in a chapter by it selv. For a short explanation for what is what - look at the setup for more info. A good idea is to put all hardworking ressources into the CORE server - so the more power in the CORE the better result in the end.

CORE: The server that holds the MySQL, Storage, tunercards, etc etc - so put all your money in this machine!!!!

Frontends: Recieve the signal from the CORE server using 1000mbs Network - but also getting the last details - such as sound etc ( Stereo, 5.1, 7.1 etc) and also which kind of TV-signal you'll put into your TV. But not processing the hard part!

But the default install of ArchLinux and packages are allmost the same thing. But you need to start with downloading the latest image from Debian Mirrorlist here.

Download the image that fit your machines needs. Then you need to make a default install - as described here. I don't want to do that - carse then this guide will be way to long. but this will get you up and running with only the smallest default install, which is all you need. Afterwards the default install - You're ready to go. In my case the CORE server holds 4Harddrive with each 500GB - called sda, sdb, sdc, sdd. For making a lot of things easier, I have made a directory called /storage og 4 subdirectory's - all that are made with these commands:

$ mkdir -p /storage/music
$ mkdir /storage/movies
$ mkdir /storage/records
$ mkdir /storage/pictures

And mount the shares fron NAS in the most demanding directory's for myth - so added these lines in /etc/fstab:

################################################################
# Mounted harddrives from NASSERVER
################################################################
//10.0.0.6/movies /storage/movies cifs rw,user=myth,password=XXXXXX  0 0
//10.0.0.6/music /storage/music cifs rw,user=myth,password=XXXXXX 0 0
//10.0.0.6/data /storage/data cifs rw,user=myth,password=XXXXXX 0 0
//10.0.0.6/pictures /storage/pictures cifs rw,user=myth,password=XXXXXX 0 0

On Frontends you allso need the recorded Directory, which lies on the MBE.

Now your discs will be mountet and usefull allready from boot. Since I had decidet to make my system a "Under the stairs" solution, I need a user to make all this happend the rigth way. So making the user:

$ useradd myth (you'll be asked some information - fill out these info - Groups = wheel,optical,audioo,video)
$ chown -R myth.users /storage
$ chmod -R 777 /storage

Now we have the different directory's that we're needing for sharing MythTV across a local network. Now we're ready to install the different packages - starting ouyt with updating the defaultDebian installation. So:

$ apt-get update
$ apt-get dist-upgrade

Afterwards the standard installation are updated, we can now begin to install the packages for beeing able to run MythTV Backend on the server. What we need here is:
NFS - PORTMAP - MYSQL - OPENSSH - APACHE - PHP (evt DHCP - if not in router - or you want to use diskless frontends)
So we need to install those packages on the machine running Masterbackend ( in my case CORE)

$ apt-get install fglrx-driver libdrm-dev libdrm-radeon1 libdrm2 libkms1 git build-essential

 

Now we're ready to share the directory where we store all our recorded programs:

####################################################
# My shared discs for use in my MythTV system
####################################################
/storage/records 172.16.20.1/24(rw,sync,subtree_check)

You'll also have to check that the file /etc/conf.d/nfs has this line - if not - write it in there:

STATD_OPTS="-no-notify"

That's all needed for sharing our network for now. You'll also have to configure your Apache/php to work together. so the php5 module should be loaded. Set up the ntp(timeserver) for being sure that the recording are started at the rigth time,

After installing all these packages, we need to check the hardware out - to be sure that all hardware are detected correctly? Do this:

$ lspci
00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 02)
00:01.0 PCI bridge: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1e.2 Multimedia audio controller: Intel Corporation 82801G (ICH7 Family) AC'97 Audio Controller (rev 01)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc RV380 [Radeon X600 (PCIE)]
01:00.1 Display controller: ATI Technologies Inc RV380 [Radeon X600]
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
04:02.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 11)
05:08.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)
05:09.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

As you can see here, all my hardware is detected - if not update the list over the different hardware - with this command:

$ update-pciids

These are the daemons that are startet at boottime! So since I placed my CORE in the garage - ssh access is a wonderfull thing these days. And at the same time add this line to /etc/hosts.allow, which are the connections we're allowing on our system:

sshd: ALL
nfsd: ALL
portmap: ALL
mountd: ALL
statd: ALL
rquotad: ALL
lockd: ALL
mysqld: ALL
6543: ALL
6544: ALL

Now we need to setup MySQL, so we have the rigth permission and access to the Database. So start up the MySQL database:

$ /etc/rc.d/mysqld start

Start by setting the administrator password to the database:

mysqladmin -u root password

Now edit the configuration file for MySQL placed in /etc/my.cnf - make sure these 2 lines are exactly like this:

# skip-networking (important with the # in front = ignored
&
log = /var/log/mysqld.log (which makes a logfile for debugging)

Now you're ready to reboot the machine for the first time - and access it through SSH! After rebooting the machine and logging into the shell - you could run a dmesg to see if your Tunercard is loaded properly:

Linux video capture interface: v2.00
ivtv: Start initialization, version 1.0.0
ivtv0: Initializing card #0
ivtv0: Autodetected Hauppauge card (cx23416 based)
ACPI: PCI Interrupt 0000:05:08.0[A] -> GSI 18 (level, low) -> IRQ 21
ivtv0: Loaded v4l-cx2341x-enc.fw firmware (376836 bytes)
ivtv0: Encoder revision: 0x02060039
tveeprom 0-0050: Hauppauge model 23659, rev D491, serial# 8092776
tveeprom 0-0050: tuner model is Philips FQ1216AME MK4 (idx 91, type 56)
tveeprom 0-0050: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) (eeprom 0x74)
tveeprom 0-0050: second tuner model is Philips TEA5768HL FM Radio (idx 101, type 62)
tveeprom 0-0050: audio processor is CX25843 (idx 37)
tveeprom 0-0050: decoder processor is CX25843 (idx 30)
tveeprom 0-0050: has radio, has no IR receiver, has no IR transmitter
ivtv0: Autodetected WinTV PVR 500 (unit #1)
tuner 0-0043: chip found @ 0x86 (ivtv i2c driver #0)
tda9887 0-0043: tda988[5/6/7] found @ 0x43 (tuner)
tuner 0-0060: TEA5767 detected.
tuner 0-0060: chip found @ 0xc0 (ivtv i2c driver #0)
tuner 0-0060: type set to 62 (Philips TEA5767HN FM Radio)
tuner 0-0061: chip found @ 0xc2 (ivtv i2c driver #0)
cx25840 0-0044: cx25843-23 found @ 0x88 (ivtv i2c driver #0)
cx25840 0-0044: loaded v4l-cx25840.fw firmware (16382 bytes)
wm8775 0-001b: chip found @ 0x36 (ivtv i2c driver #0)
tuner 0-0061: type set to 56 (Philips PAL/SECAM multi (FQ1216AME MK4))
ivtv0: Registered device video0 for encoder MPEG (4 MB)
ivtv0: Registered device video32 for encoder YUV (2 MB)
ivtv0: Registered device vbi0 for encoder VBI (1 MB)
ivtv0: Registered device video24 for encoder PCM audio (1 MB)
ivtv0: Registered device radio0 for encoder radio
ivtv0: Initialized card #0: WinTV PVR 500 (unit #1)
ivtv1: Initializing card #1
ivtv1: Autodetected Hauppauge card (cx23416 based)
ACPI: PCI Interrupt 0000:05:09.0[A] -> GSI 19 (level, low) -> IRQ 23
ivtv1: Loaded v4l-cx2341x-enc.fw firmware (376836 bytes)
ivtv1: Encoder revision: 0x02060039
tuner 1-0043: chip found @ 0x86 (ivtv i2c driver #1)
tda9887 1-0043: tda988[5/6/7] found @ 0x43 (tuner)
tuner 1-0061: chip found @ 0xc2 (ivtv i2c driver #1)
cx25840 1-0044: cx25843-23 found @ 0x88 (ivtv i2c driver #1)
cx25840 1-0044: loaded v4l-cx25840.fw firmware (16382 bytes)
wm8775 1-001b: chip found @ 0x36 (ivtv i2c driver #1)
tveeprom 1-0050: Hauppauge model 23659, rev D491, serial# 8092776
tveeprom 1-0050: tuner model is Philips FQ1216AME MK4 (idx 91, type 56)
tveeprom 1-0050: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) (eeprom 0x74)
tveeprom 1-0050: second tuner model is Philips TEA5768HL FM Radio (idx 101, type 62)
tveeprom 1-0050: audio processor is CX25843 (idx 37)
tveeprom 1-0050: decoder processor is CX25843 (idx 30)
tveeprom 1-0050: has radio, has no IR receiver, has no IR transmitter
ivtv1: Correcting tveeprom data: no radio present on second unit
ivtv1: Autodetected WinTV PVR 500 (unit #2)
tuner 1-0061: type set to 56 (Philips PAL/SECAM multi (FQ1216AME MK4))
ivtv1: Registered device video1 for encoder MPEG (4 MB)
ivtv1: Registered device video33 for encoder YUV (2 MB)
ivtv1: Registered device vbi1 for encoder VBI (1 MB)
ivtv1: Registered device video25 for encoder PCM audio (1 MB)
ivtv1: Initialized card #1: WinTV PVR 500 (unit #2)
ivtv: End initialization

When you got that one loaded - you're now ready to install all the packages for MythTV installation. For getting the lastest release of MythTV - you need to edit /etc/apt/sources.list - and  add the multimedia archive for debian

deb http://www.debian-multimedia.org stable main non-free

And the download the deb-key and install it - so you'll don't get any errors while updating your system:

$ wget http://www.debian-multimedia.org/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2010.12.26_all.deb

$ dpkg -i debian-multimedia-keyring_2010.12.26_all.deb
$ apt-get update
$ apt-get dist-upgrade

This upgrades the normal packages for all archives, so now we'll install the mythtv-backend - so we'll get all the required packages for mythjtv

$ apt-get install mythtv-backend

This will install mythtv latest stable release, but since I'm running the latest gitversion, you can see the scripts etc further down! But using the default mythtv-backend package from multimedia, gives us all the depencies for running stable version, allthough you'll need many more packages for running latest git-version.

 

Afterwards you're ready to setup MythTV!

----------------------------------------------------------------------------------------------------------

MythTV - From GIT - trunk:

If you want the newest of the newest, you can use MythTV-git version, but this gives some extra packages etc to install

Since you have to rebuild the package each time there's a new version in mythtv git, but here's how I did it.

  1. Create a dir ~/AUR.
  2. Download mythtv using the latest git version
$ git clone git://github.com/MythTV/mythtv.git
$ git clone git://github.com/MythTV/mythweb.git

This downloades the latest MythTV version, and now we're ready to use our script depending on which type of machine it is - different CPU's etc - but here's the default script :

# Go to dir
cd /root/AUR/mythtv/mythtv
# update files.
git pull

# Build MythTV
cd mythtv
# Clearing Dist
make distclean
rm -rf /usr/lib/mythtv/*
# building from scratch
./configure --prefix=/usr --cpu=x86_64 --enable-mmx --enable-audio-oss --enable-audio-alsa --disable-audio-jack --disable-audio-pulse --disable-altivec --disable-distcc --disable-ccache --enable-vdpau --enable-dvb --dvb-path=/usr/include --enable-lirc --enable-joystick-menu --enable-ivtv --enable-firewire --enable-xrandr --enable-xv --enable-x11 --with-bindings=perl,python && make -j 4 && make install
# Finished building - go to plugins
cd ../mythplugins/
# Claering
make distclean
# Building from scratch
./configure --prefix=/usr --enable-all --enable-mytharchive --enable-mythbrowser --enable-mythgallery --enable-mythgame  --enable-mythmusic --enable-mythnews --enable-mythweather --enable-mythzoneminder && make -j 4 && make install
# Finshing
echo "finished building MyhtTV + Plugins"

This will delete all old packages, afterwards update from TRUNK and install the packages automatickly. Easy nice and quit.