Installing MythTV on Debian

From MythTV Official Wiki
Jump to navigation Jump to search

This page is up-to-date as of MythTV version 36.0, the current release is 36.0

Introduction

This page will describe how to build MythTV from source and then install using the package manager.

See Packages to install pre-built packages.

Build your own Packages

Dependencies

sudo apt update
sudo apt upgrade
sudo apt install git


Building in a chroot "clean room" environment (pbuilder)

This is section describes an alternate build approach which will not be necessary for most users.

Some users may desire, or need, to build MythTV in a chroot environment, for reasons including

  • Not wanting to (permanently) install packages on the build machine which are only need to build MythTV.
  • Wanting to build packages which are as portable as possible to distribute to other hosts.
  • For systemd-free Debian derivatives, such as Devuan, where installing libsystemd-dev is not possible, using a chroot environment is necessary (and preferred) to avoid manually updating the MythTV packages.

While multiple tools exist to build Debian packages in a chroot environment, this page will address the use of pbuilder.

Users who choose to build with pbuilder will need to follow a couple additional steps here, and use an alternative build script below.

Step Command to run
Install pbuilder and dependencies sudo apt-get install pbuilder debootstrap lsb-release
Install additional dependency
(see https://github.com/MythTV/packaging/issues/237)
sudo apt-get install dh-python
Create the chroot environment sudo pbuilder create --distribution $(/usr/bin/lsb_release -sc)

Getting and compiling the source code

In general, you should probably choose the stable version. If you do not mind if your MythTV system is non-functional or has serious bugs that may prevent proper operation, result in lost recordings, or inability to play back recordings, you may try using the unstable, development code by replacing fixes/36 with master in the instructions below. If using development code, you should follow the mythtv-commits and mythtv-dev mailing lists.

Note: The following example builds and installs the Debian packages under the user's home directory. Once the packages are built, the user _apt must have read access to the location of the packages, which includes execute access for the entire path (BOTH /home/mythtv AND /home/mythtv/build, for example). It is likely the user's home directory will not allow execute access to others, and therefore apt will not be able to access the packages unless permissions are changed or the packages are moved (or built somewhere that _apt can access). This note should not apply when using pbuilder.

Step Command to run
create a directory mkdir -p ~/build
clone the git mythtv packages cd ~/build
git clone https://github.com/MythTV/packaging.git -b fixes/36
cd packaging/deb
Start the build. This script checks out the latest version of fixes/36 from git and builds the packages. If NOT building with pbuilder
./build-debs.sh fixes/36

If building with pbuilder
./build-dsc.sh fixes/36
sudo pbuilder build *.dsc
cd /var/cache/pbuilder/result
sudo touch Packages.gz
sudo chown $(id -nu):$(id -ng) Packages.gz

Once the build is complete there will be a lot of .deb files in the current directory.

Choose Your Package

Decide what type of installation you need.

If this is your first system and you are using a single box for recording and watching, you need a complete frontend, backend and database. Choose the mythtv package.

If you are adding a Frontend to an existing system, to allow for watching on another TV or computer system, choose the mythtv-frontend package.

If you are adding a Slave Backend use mythtv-backend. This is an advanced usage that few people will need.

There are packages for installing a complete system, or for installing parts of a multi server system.

Available Packages
mythtv Complete frontend and backend system with database.
mythtv-frontend Frontend that connects to a separate backend.
mythtv-backend Backend without database. This is either a master backend where there is a separate database server or a slave backend.
mythtv-backend-master Master Backend with database.
mythtv-database MythTV database only. Advanced use where there is a separate database server from backend. You will need to also install mysql server when using this.
mythplugins Plugins for a frontend system. Install this after installing your main package from earlier in this list.
mythweb (prior to v35) MythWeb provided a frontend for scheduling and managing recordings from a web browser. Mythweb has been replaced by the Web Application at http://your_backend:6544 which is included in the MythTV backend and requires no separate installation.

Install Software

Install one of the newly created packages, as follows:

dpkg-scanpackages -m . | gzip -c > Packages.gz
echo "deb [trusted=yes] file:$(pwd) ./" | sudo tee /etc/apt/sources.list.d/mythtv.list
sudo apt-get update
sudo apt-get install packagename


Note: The procedures in this article have created packages as a non-root user, and configured the system to trust packages created by that user which reside in a certain directory. This is quite insecure, as should the user account be compromised, an attacker could put arbitrary packages in the directory and have them installed and executed with root privileges. /etc/apt/sources.list.d/mythtv.list should be removed once the packages are installed.


The packages do the following:

  • Create the user mythtv, if necessary.
  • Install MythTV software and all prerequisites.
  • Install MariaDB database software, if necessary.
  • Create a MariaDB database user for MythTV, if necessary.
  • Set up the MythTV configuration file.
  • Create the mythtv-backend service for systemd to automatically run the backend at system startup time, if applicable.
  • Configure a weekly backup of the database using cron, if applicable.
  • Create desktop entries to launch MythTV from various desktop menus.
  • Install rsyslog configuration (but does not install rsyslog)


Once the software is installed, proceed to Post Installation Tasks.