Linux HOWTOs

About | Home | Search


HOWTO: mythtv
Description: Homebrew PVR (like TiVo, Freevo, etc.) project
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# MythTV 0.20
# ===========
# There is another version of this howto that covers installing MythTV 0.20
# from Subversion instead of the tarball.  That version includes fixes that
# the tarball doesn't.  The other one is here.

# Here are some links that may be helpful with installing and using MythTV:
# MythTV Home Page
# MythTV Wiki (FAQ, HOWTOs, ...)
# MythTV Users mailing list archive
# MythTVtalk.com
# MythTV Forum
# MythTV Trac
# KnoppMyth - A Knoppix + MythTV CD
# MythDora - A Fedora Core + MythTV CD

# If you ever want to uninstall MythTV, or just clean up files from an
# older version before installing a new one, skip down to the bottom for
# instructions.

# Prerequisites:
# libmp3lame
# xmltv (if the backend and frontend are different machines,
#  it's only required on the backend)
# MySQL (ditto)
# Configured zap2it.com DataDirect service
# lirc (for remote control support)
# ivtv (if that's the kind of card that you have)
# DVB support in your kernel
# ALSA or OSS
# aRts
# Jack
# XFree86 or X.org
# DirectFB
# Qt

# If you run Slackware, make sure you have the kernel-headers module
# installed that came with Slackware (2.4.x) and not the one from testing
# (2.6.x) or it will fail to build because of the 2.6 version of joystick.h

cd
test -f installed/mythtv-0.20.tar.bz2 &&
 mv installed/mythtv-0.20.tar.bz2 .
test ! -f mythtv-0.20.tar.bz2 &&
 wget http://ftp.osuosl.org/pub/mythtv/mythtv-0.20.tar.bz2
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "mythtv-*" -exec rm -r {} \;
tar xjvf ~/mythtv-0.20.tar.bz2
cd mythtv-0.20
test $UID = 0 && chown -R root:root .
./configure
qmake mythtv.pro
make

# Become root to install it
su

# Read ./UPGRADING to make sure you don't have to do anything extra if
# you're upgrading from an older version.

# If this is an upgrade for you, back up your existing MySQL database.
# -u is your MySQL username, -p is your password, if your database is not
# named "mythconverg" replace that with whatever it is.  If your MySQL
# server is on a different host, add -h foo.domain.org (before the db name).
test ! -d ~/backup && mkdir -p -m 0700 ~/backup
mysqldump -u mythtv -pmythtv mythconverg -c > ~/backup/mythtv.sql

# Configure MySQL:
# This is only be necessary if this is a new installation.  Database updates
# will be handled automatically when you upgrade.  Leave off the -p if you
# don't have a MySQL root password set (!!).  If your MySQL server is a
# remote machine, scp mc.sql to it and run it there.
( cd database ; mysql -p < mc.sql )

# Stop mythbackend if it's running:
test -x /etc/rc.d/rc.mythbackend && /etc/rc.d/rc.mythbackend stop
sleep 2
killall mythbackend

# Remove files from old versions:
test -d /usr/local/include/mythtv && rm -r /usr/local/include/mythtv
test -d /usr/local/lib/mythtv && rm -r /usr/local/lib/mythtv
test -d /usr/local/share/mythtv && rm -r /usr/local/share/mythtv
( cd /usr/local/bin ; rm -f mythbackend mythbrowser mythcommflag mythepg \
 mythfilldatabase mythfrontend mythjobqueue mythlcdserver mythprogfind \
 mythreplex mythshutdown mythtranscode mythtv mythtv-setup mythtvosd \
 mythwelcome )
( cd /usr/local/lib ; rm -f libmyth-* libmythavcodec-* libmythavformat-* \
 libmythavutil-* libmythdvdnav-* libmythfreemheg-* libmythlivemedia-* \
 libmythmpeg2-* libmythsamplerate-* libmythsoundtouch-* libmythtv-* \
 libmythui-* libmythupnp-* )

# Install the new version:
make install
ldconfig

# You can find a sample init script or two in contrib, or try mine.  Add
# something to rc.local to start "/etc/rc.d/rc.mythbackend start" on boot-up
# and "/etc/rc.d/rc.mythbackend stop" to rc.0/rc.6 to stop it on
# shut-down/reboot.
cd /etc/rc.d
test -f rc.mythbackend &&
 ( mv -f rc.mythbackend rc.mythbackend.old
   chmod 600 rc.mythbackend.old )
wget -nc http://englanders.cc/pub/linux/misc/rc.mythbackend
chmod 700 rc.mythbackend

# Set up logrotate to rotate mythbackend's logfile:
cat << EOF > /etc/logrotate.d/mythbackend
/var/log/mythbackend.log {
  rotate 6
  daily
  copytruncate
  missingok
}
EOF

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/mythtv-*.tar.*
mv mythtv-0.20.tar.bz2 installed/

# If this is an upgrade for you, after you have the themes and plugins
# installed, you'll want to stop mythbackend and run mythtv-setup before
# trying to use it.

# All of the other procedures for installing are covered here:
# http://mythtv.org/modules.php?name=MythInstall


# Themes
# ======
cd
test -f installed/myththemes-0.20.tar.bz2 &&
 mv installed/myththemes-0.20.tar.bz2 .
test ! -f myththemes-0.20.tar.bz2 &&
 wget http://ftp.osuosl.org/pub/mythtv/myththemes-0.20.tar.bz2
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "myththemes-*" -exec rm -r {} \;
tar xjvf ~/myththemes-0.20.tar.bz2
cd myththemes-0.20
test $UID = 0 && chown -R root:root .
./configure
qmake myththemes.pro
su -c "make install"
cd
mkdir -p -m 0700 installed
rm -f installed/myththemes-*.tar.*
mv myththemes-0.20.tar.bz2 installed/


# Plugins
# =======
# Prerequisites (beyond those listed above):
#
# MythBrowser:
# KDE
#
# MythDVD:
# libdvdread (this down to transcode are required for transcoding)
# nasm
# mjpegtools
# xvid
# liba52
# libfame
# transcode
# libdvdcss (to read encrypted DVDs)
# mplayer, ogle, and/or xine (to play DVDs), xine for VCDs
#
# MythGallery:
# libtiff
# libexif
#
# MythGame:
# zlib
#
# MythMusic:
# mad
# vorbis
# flac
# libcdaudio
# cdparanoia
# fftw (optional)
# sdl (optional)
# faad (optional) - With 2.x, copy common/mp4ff/mp4ff_int_types.h
#  and common/mp4ff/mp4ff.h to /usr/local/include/ and
#  common/mp4ff/libmp4ff.a to /usr/local/lib/
#
# MythPhone:
# festival (optional)

cd
test -f installed/mythplugins-0.20.tar.bz2 &&
 mv installed/mythplugins-0.20.tar.bz2 .
test ! -f mythplugins-0.20.tar.bz2 &&
 wget http://ftp.osuosl.org/pub/mythtv/mythplugins-0.20.tar.bz2
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "mythplugins-*" -exec rm -r {} \;
tar xjvf ~/mythplugins-0.20.tar.bz2
cd mythplugins-0.20
test $UID = 0 && chown -R root:root .

# My KDE is installed under /opt/kde, the MythTV source assumes that it's
# /opt/kde3.  Here I fix the path in a few places.  If yours is installed
# /under /opt/kde3, skip this part.  If you're not going to install
# MythBrowser, skip this part.
grep -q /opt/kde3 configure &&
 ( cat configure | sed 's%/opt/kde3%/opt/kde%' > configure.new
   test -s configure.new &&
    ( mv -f configure configure.orig
      mv -f configure.new configure
      chmod 700 configure
      chmod 600 configure.orig ) )
grep -q /opt/kde3 mythbrowser/mythbrowser/mythbrowser.pro &&
 ( cd mythbrowser/mythbrowser
   cat mythbrowser.pro | sed 's%/opt/kde3%/opt/kde%' > mythbrowser.pro.new
   test -s mythbrowser.pro.new &&
    ( mv -f mythbrowser.pro mythbrowser.pro.orig
      mv -f mythbrowser.pro.new mythbrowser.pro ) )

# I gave up on getting Festival to build in to it.  I think the configure
# script is totally missing the SPEECHTOOLSDIR part, it doesn't honor
# FESTIVALDIR or SPEECHTOOLSDIR for finding the libraries, ...  for me, not
# worth all of the changes that I'd have to make.

# It failed to build in mythmusic/mythmusic/playlist.cpp, I tried to change
# something (a total guess) to get it to build, then it failed with a
# different error.  I gave up and had it skip MythMusic
# (./configure --disable-mythmusic).

# If you want to build and install all plugins in one shot, after making
# sure you've got all of the prerequisites installed, configure it with
# --enable-all.  Otherwise see './configure --help' to see how to enable
# certain plugins.  Also check out myth*/README

# FYI, I did build and install all of them, but ended up disabling mythphone
# by renaming libmythphone.so to libmythphone.so.old in
# /usr/local/lib/mythtv/plugins.  It tries to make a SIP connection on
# startup, slowing it down a little, ...

./configure --enable-all
qmake mythplugins.pro
make
su -c "make install"
cd
mkdir -p -m 0700 installed
rm -f installed/mythplugins-*.tar.*
mv mythplugins-0.20.tar.bz2 installed/


# (Re)start mythbackend (if this is an upgrade and you're done):
su -c "/etc/rc.d/rc.mythbackend start"

# Once it's running and all is well, you can see it's status here, (unless
# you change the default port):
# http://localhost:6544/
# (if it's not running on localhost, replace that with where it is running)


# If you ever want to uninstall mythtv, this should do it:
cd
su
test -d src/mythtv-* && ( cd src/mythtv-* ; make uninstall )
test -d src/myththemes-* && ( cd src/myththemes-* ; make uninstall )
test -d src/mythplugins-* && ( cd src/mythplugins-* ; make uninstall )
rm -f /etc/logrotate.d/mythbackend
( cd /usr/local/bin ; rm -f mythbackend mythcommflag mythfilldatabase \
 mythfrontend mythepg mythjobqueue mythprogfind mythtranscode mythtv \
 mythtv-setup mythtvosd )
( cd /usr/local/lib ; rm -f libmyth-* libmythtv-* libmythavcodec-* \
 libmythavformat-* libmythmpeg2-* libmythsamplerate-* libmythsoundtouch-* )
test -d /usr/local/lib/mythtv && rm -r /usr/local/lib/mythtv
test -d /usr/local/share/mythtv && rm -r /usr/local/share/mythtv
test -d /usr/local/include/mythtv && rm -r /usr/local/include/mythtv
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "mythtv-*" -exec rm -r {} \;
find ~/src -maxdepth 1 -type d -name "myththemes-*" -exec rm -r {} \;
find ~/src -maxdepth 1 -type d -name "mythplugins-*" -exec rm -r {} \;
( cd ~/installed ; rm -f mythtv-*.tar.* myththemes-*.tar.* \
 mythplugins-*.tar.* )
test -d ~/.mythtv &&
 ( mkdir -p -m 0700 ~/backup/home-${USER}-dot-mythtv
   cp -a ~/.mythtv/* ~/backup/home-${USER}-dot-mythtv/
   rm -r ~/.mythtv )

# If you see anything else left over in /usr/local/bin, /usr/local/lib,
# /usr/local/share, or /usr/local/include that has myth in it, it's probably
# part of MythTV.  After confirming that, remove it too.

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>