Difference between revisions of "Build from Source"

From MythTV Official Wiki
Jump to: navigation, search
(Add link to Database Setup page)
m (Add -j option for make and remove duplication of git prerequisite)
(10 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
*The pre-built package for your distribution is out of date.
 
*The pre-built package for your distribution is out of date.
 
*You want to run a pre-release version of the software.
 
*You want to run a pre-release version of the software.
 +
*Users choose to test/write patches.
  
 
If you have already installed a pre-built package and you have a need to try out a source code change, it would be preferable to use your distribution's build process to build a version that is compatible with the already installed version. There are differences in the placement of files between the downloaded packages and the code you build yourself.
 
If you have already installed a pre-built package and you have a need to try out a source code change, it would be preferable to use your distribution's build process to build a version that is compatible with the already installed version. There are differences in the placement of files between the downloaded packages and the code you build yourself.
Line 16: Line 17:
  
 
{| class="mw-collapsible mw-collapsed wikitable"
 
{| class="mw-collapsible mw-collapsed wikitable"
! Build Dependencies for version 0.27
+
!colspan="2"| Build Dependencies for version 0.27
 
|-
 
|-
|<code><nowiki>
+
|style="width: 10%;"| All Environments
ccache yasm libqt4-dev libqtwebkit-dev libqt4-opengl-dev libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libcrystalhd-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev
+
|style="width: 90%;"|<code><nowiki>
libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev
+
ccache yasm libqt4-dev libqtwebkit-dev libqt4-opengl-dev po-debconf texi2html  linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev uuid-dev libxml-xpath-perl
libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff4-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev
+
</nowiki></code>
libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev uuid-dev libxml-xpath-perl autoconf gdb
+
|-
 +
| i386/amd64
 +
| Add this: <code><nowiki> libcrystalhd-dev </nowiki></code>
 +
|-
 +
| Notes
 +
| If <code><nowiki>libtiff5-dev</nowiki></code> is unavailable use <code><nowiki>libtiff4-dev</nowiki></code>.
 +
 
 +
If you are building a Debian or Ubuntu package using dpkg-buildpackage you will need these additional packages:
 +
<code><nowiki> debhelper quilt dh-python </nowiki></code>
 +
 
 +
If <code>dh-python</code> is not available use <code>python-central</code> instead.
 +
|}
 +
{| class="mw-collapsible mw-collapsed wikitable"
 +
!colspan="2"| Build Dependencies for version 0.28
 +
|-
 +
|style="width: 10%;"| All Environments
 +
|style="width: 90%;"|<code><nowiki>
 +
ccache yasm help2man qtdeclarative5-dev libqt5webkit5-dev libqt5opengl5-dev qtscript5-dev qt5-qmake po-debconf linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev libexiv2-dev uuid-dev libxml-xpath-perl git hello
 
</nowiki></code>
 
</nowiki></code>
 +
|-
 +
| i386/amd64
 +
| Add this: <code><nowiki> libcrystalhd-dev </nowiki></code>
 +
|-
 +
| raspberry pi
 +
| Add this: <code><nowiki> libraspberrypi-dev </nowiki></code>
 +
|-
 +
| Notes
 +
|If you are building a Debian or Ubuntu package using dpkg-buildpackage you will need these additional packages:
 +
<code><nowiki> debhelper quilt dh-python </nowiki></code>
 
|}
 
|}
 
 
{| class="mw-collapsible mw-collapsed wikitable"
 
{| class="mw-collapsible mw-collapsed wikitable"
! Build Dependencies for version 0.28
+
! Run Time Dependencies for version 0.27
 
|-
 
|-
 
|<code><nowiki>
 
|<code><nowiki>
ccache yasm help2man qtdeclarative5-dev libqt5webkit5-dev libqt5opengl5-dev qtscript5-dev qt5-qmake libdvb-dev po-debconf linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libcrystalhd-dev libxvmc-dev libxext-dev libimlib2-dev
+
mysql-server ntp libicu48 libqt4-sql-mysql
libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl dh-python python python-oauth python-lxml python-mysqldb
 
python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl
 
libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev libexiv2-dev uuid-dev libxml-xpath-perl autoconf gdb
 
 
</nowiki></code>
 
</nowiki></code>
 
|}
 
|}
  
 
{| class="mw-collapsible mw-collapsed wikitable"
 
{| class="mw-collapsible mw-collapsed wikitable"
! Run Time Dependencies for version 0.27
+
! Run Time Dependencies for version 0.28
 
|-
 
|-
 
|<code><nowiki>
 
|<code><nowiki>
mysql-server ntp libicu48
+
mysql-server-5.6 ntp libicu55 libqt5sql5-mysql mysql-client-5.6
 
</nowiki></code>
 
</nowiki></code>
 
|}
 
|}
Line 63: Line 87:
 
|style="width: 45%;"|Ubuntu, Debian, MythBuntu, other Debian based distributions.
 
|style="width: 45%;"|Ubuntu, Debian, MythBuntu, other Debian based distributions.
 
|style="width: 40%;"|<code>sudo apt-get install </code>''Dependency List''
 
|style="width: 40%;"|<code>sudo apt-get install </code>''Dependency List''
|style="width: 15%;"|<pre>build-essential git</pre>
+
|style="width: 15%;"|<pre>build-essential</pre>
 
|}
 
|}
 
Depending on your distribution, run the install command with the list of packages.
 
Depending on your distribution, run the install command with the list of packages.
Line 93: Line 117:
 
By default the build will install mythtv in a directory structure under /usr/local/. Executables will be in /usr/local/bin. You can modify this behavior with the --prefix= parameter. The default prefix is /usr/local.
 
By default the build will install mythtv in a directory structure under /usr/local/. Executables will be in /usr/local/bin. You can modify this behavior with the --prefix= parameter. The default prefix is /usr/local.
  
Normally you will not need to supply any options to configure. Run it as follows:<br>
+
Normally you will not need to supply any options to configure, although 0.27 users should add ''--disable-mythlogserver'' ([[Mythlogserver|mythlogserver]]). Run it as follows:<br>
 
<pre>./configure</pre>
 
<pre>./configure</pre>
 
The configure step may identify dependencies that are missing. If so you will need to find them and install them before continuing. Please let us know via an update to this page or make a comment in th discussion page.
 
The configure step may identify dependencies that are missing. If so you will need to find them and install them before continuing. Please let us know via an update to this page or make a comment in th discussion page.
  
 
If the configure was successful, run the build as follows
 
If the configure was successful, run the build as follows
<pre>make</pre>
+
<pre>make -j 5</pre>
 +
The -j option is optional but can speed up the make by running multiple processes at the same time. Set the number to 1 higher than tyhe number of cores in your system.<br>
 
The build may identify missing dependencies. Install them and notify us via a comment in the discussion.<br>  
 
The build may identify missing dependencies. Install them and notify us via a comment in the discussion.<br>  
 
When the build is successful, install this way
 
When the build is successful, install this way
Line 110: Line 135:
 
In the ~/build/mythtv/mythplugins directory, run the same commands as above for building and installing MythTV. If you only want to build certain plugins, you can disable the others in the ./configure command (check the --help for the syntax for that).
 
In the ~/build/mythtv/mythplugins directory, run the same commands as above for building and installing MythTV. If you only want to build certain plugins, you can disable the others in the ./configure command (check the --help for the syntax for that).
 
<pre>./configure
 
<pre>./configure
make
+
make -j 5
 
sudo make install</pre>
 
sudo make install</pre>
 
===Shared-Library requirements for MythTV===
 
===Shared-Library requirements for MythTV===
Line 156: Line 181:
  
 
<pre>cd ~/build/mythweb/
 
<pre>cd ~/build/mythweb/
sudo mkdir /usr/local/share/mythtv/mythweb/
+
sudo cp -r ~/build/mythweb /usr/local/share/mythtv/mythweb
sudo cp -rv ~/build/mythweb /var/www/mythweb
+
sudo ln -s /usr/local/share/mythtv/mythweb/ /var/www/html/
sudo ln -s /usr/local/share/mythtv/mythweb/ /var/www/
 
 
sudo cp -v /usr/local/share/mythtv/mythweb/mythweb.conf.apache /etc/apache2/sites-available/mythweb.conf
 
sudo cp -v /usr/local/share/mythtv/mythweb/mythweb.conf.apache /etc/apache2/sites-available/mythweb.conf
 
</pre>
 
</pre>
 
Edit file /etc/apache2/sites-available/mythweb.conf using gedit or vi, for example:
 
Edit file /etc/apache2/sites-available/mythweb.conf using gedit or vi, for example:
 
<pre>sudo vi /etc/apache2/sites-available/mythweb.conf</pre>
 
<pre>sudo vi /etc/apache2/sites-available/mythweb.conf</pre>
Change the lines containing ''<Directory "/var/www/html/data">'' and ''<Directory "/var/www/html" >'' so that they read ''<Directory "/var/www/mythweb/data">'' and ''<Directory "/var/www/mythweb" >'', i.e. change the ''html'' to ''mythweb''.
+
Change the lines containing ''<Directory "/var/www/html/data">'' and ''<Directory "/var/www/html" >'' so that they read ''<Directory "/var/www/html/mythweb/data">'' and ''<Directory "/var/www/html/mythweb" >'', i.e. add the ''mythweb'' subdirectory.
 
<pre>
 
<pre>
 
sudo a2enmod rewrite
 
sudo a2enmod rewrite
Line 184: Line 208:
 
MythTV backend needs to run as its own user. This should be a system account. Create a user as follows:
 
MythTV backend needs to run as its own user. This should be a system account. Create a user as follows:
 
<pre>sudo useradd --system mythtv</pre>
 
<pre>sudo useradd --system mythtv</pre>
 +
Users might want to add ''--groups cdrom,audio,video'' to the above.
  
 
=== MythTV Database Setup ===
 
=== MythTV Database Setup ===
Line 198: Line 223:
 
flush privileges;
 
flush privileges;
 
exit;</pre>
 
exit;</pre>
Run the following command to set up time zone tables:
+
Run the following command [[MySQL_Time_Zone_Tables|to set up time zone tables]]:
 
<pre>mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql</pre>
 
<pre>mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql</pre>
 
Run mythbackend. This will automatically create your database or upgrade your previous mythconverg database schema to the latest version:
 
Run mythbackend. This will automatically create your database or upgrade your previous mythconverg database schema to the latest version:
Line 212: Line 237:
  
 
=== Backend Startup ===
 
=== Backend Startup ===
For MythTV to be able to schedule and make recordings, the backend must be running at the time of the scheduled recordings. Normally this means running the backend at all times while the server is running. It should be set up to be automatically started when the server starts. This is handled automatically for you in the pre-built packages, but if you are building it yourself you have to set up some mechanism. Possible ways of doing it are ''Upstart'', ''init script'', ''/etc/rc.local''. Ubuntu packages run it from Upstart, which has the ability to restart the process if it fails.
+
For MythTV to be able to schedule and make recordings, the backend must be running at the time of the scheduled recordings. Normally this means running the backend at all times while the server is running. It should be set up to be automatically started when the server starts. This is handled automatically for you in the pre-built packages, but if you are building it yourself you have to set up some mechanism. Possible ways of doing it are ''[[Systemd_mythbackend_Configuration|systemd]]'', ''[[Upstart_mythbackend_Configuration|Upstart]]'', ''init script'', ''/etc/rc.local''. Ubuntu packages run it from Upstart (but is likely to switch to systemd in 16.04), which has the ability to restart the process if it fails.
  
 
The simplest way will be by editing the rc.local. Use ''gksudo gedit'' to edit rc.local and add the following line:
 
The simplest way will be by editing the rc.local. Use ''gksudo gedit'' to edit rc.local and add the following line:
 
<pre>/usr/local/bin/mythbackend -d --logpath /tmp/ --user mythtv</pre>
 
<pre>/usr/local/bin/mythbackend -d --logpath /tmp/ --user mythtv</pre>
This is a very basic and simplistic approach, but will work. For a reliable system you need to use something more advanced like Upstart. If you install from the Ubuntu or MythBuntu package the Upstart setup is done for you. Also you may want to create a directory other than /tmp/ for your logs. Note that whatever directory you create for logs must be writeable by the mythtv user as well as frontend users. The frontend user if your normal Linux login, which you will use for viewing MythTV.
+
This is a very basic and simplistic approach, but will work. For a reliable system you need to use something more advanced like Upstart. If you install from the Ubuntu or MythBuntu package the Upstart setup is done for you. Also you should create a directory other than /tmp/ for your logs. ''/var/log/mythtv'' is the popular location. Note that whatever directory you create for logs must be writeable by the mythtv user as well as frontend users. The frontend user if your normal Linux login, which you will use for viewing MythTV.
 
 
Note that logging uses a program ''mythlogserver''. If the log file is not created try adding this line before the mythbackend line:
 
<pre>su -c "/usr/local/bin/mythlogserver -d --logpath /tmp/" mythtv</pre>
 
  
 
You can get a list of options available with mythbackend by running ''mythbackend --help''.
 
You can get a list of options available with mythbackend by running ''mythbackend --help''.

Revision as of 20:38, 12 February 2016

Software-update-available.png This page is up-to-date as of MythTV version 0.27.6, the current release is 34.0

Introduction

For most people, it will be far easier to install a pre-built package for MythTV rather than building from source. Reasons for building from source include:

  • There is no pre-built package for your Linux distribution.
  • The pre-built package for your distribution is out of date.
  • You want to run a pre-release version of the software.
  • Users choose to test/write patches.

If you have already installed a pre-built package and you have a need to try out a source code change, it would be preferable to use your distribution's build process to build a version that is compatible with the already installed version. There are differences in the placement of files between the downloaded packages and the code you build yourself.

This guide shows how to build from source code downloaded from github.

Dependencies

One of the most difficult parts of building the code is getting the correct dependencies installed first. The syntax for installing these will vary from one distribution to another, and package names may also vary between distributions.

Build Dependencies for version 0.27
All Environments ccache yasm libqt4-dev libqtwebkit-dev libqt4-opengl-dev po-debconf texi2html linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev uuid-dev libxml-xpath-perl
i386/amd64 Add this: libcrystalhd-dev
Notes If libtiff5-dev is unavailable use libtiff4-dev.

If you are building a Debian or Ubuntu package using dpkg-buildpackage you will need these additional packages: debhelper quilt dh-python

If dh-python is not available use python-central instead.

Build Dependencies for version 0.28
All Environments ccache yasm help2man qtdeclarative5-dev libqt5webkit5-dev libqt5opengl5-dev qtscript5-dev qt5-qmake po-debconf linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev libexiv2-dev uuid-dev libxml-xpath-perl git hello
i386/amd64 Add this: libcrystalhd-dev
raspberry pi Add this: libraspberrypi-dev
Notes If you are building a Debian or Ubuntu package using dpkg-buildpackage you will need these additional packages:

debhelper quilt dh-python

Run Time Dependencies for version 0.27
mysql-server ntp libicu48 libqt4-sql-mysql
Run Time Dependencies for version 0.28
mysql-server-5.6 ntp libicu55 libqt5sql5-mysql mysql-client-5.6
Run Time Dependencies for MythWeb
apache2-mpm-prefork php5 php5-mysql libhttp-date-perl

The package mysql-server only needs to be installed on one backend, normally the master backend, or it can be installed on a separate database server, although this would be unusual.

On systems that do not have mysql-server (e.g. remote frontends, slave backends), you need to install mysql-client instead.

Install the build dependencies on your build machine. Install the Run Time dependencies on your MythTV machine (which may be the same as the build machine). If you plan to use MythWeb, install those dependencies on your master backend system.

Distribution Install Command Additional packages
Ubuntu, Debian, MythBuntu, other Debian based distributions. sudo apt-get install Dependency List
build-essential

Depending on your distribution, run the install command with the list of packages.

Getting and compiling the source code

Step Command to run
create a directory cd
mkdir ~/build
clone cd ~/build
git clone https://github.com/MythTV/mythtv.git mythtv
cd mythtv
Check versions available git branch -a
Choose your version. The current stable released version is 33-fixes. We recommend to use that version. git checkout fixes/0.xx

In general, you should probably choose the stable version. If you don't 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. If using unstable, development code, you should follow the mythtv-commits and mythtv-dev mailing lists.

Build and Install MythTV

In the ~/build/mythtv/mythtv directory, run the ./configure script. You can see available options by using the --help parameter with configure:

./configure --help

By default the build will install mythtv in a directory structure under /usr/local/. Executables will be in /usr/local/bin. You can modify this behavior with the --prefix= parameter. The default prefix is /usr/local.

Normally you will not need to supply any options to configure, although 0.27 users should add --disable-mythlogserver (mythlogserver). Run it as follows:

./configure

The configure step may identify dependencies that are missing. If so you will need to find them and install them before continuing. Please let us know via an update to this page or make a comment in th discussion page.

If the configure was successful, run the build as follows

make -j 5

The -j option is optional but can speed up the make by running multiple processes at the same time. Set the number to 1 higher than tyhe number of cores in your system.
The build may identify missing dependencies. Install them and notify us via a comment in the discussion.
When the build is successful, install this way

sudo make install

This will install both backend and frontend software. Install this on all machines, backend or frontend. You will only start the backend on the backend machines. On frontend machines the backend software will exist but will not be used.

Build and Install Plugins

Building and installing the plugins is optional. I recommend that new users skip this step. Plugins are not needed for any of the main functionality of MythTV, including watching Videos and watching DVDs. Plugins are for Music, Weather, YouTube, Games, etc.

Plugins are only used on the frontend, so if you have a separate backend you need not install them on the backend.

In the ~/build/mythtv/mythplugins directory, run the same commands as above for building and installing MythTV. If you only want to build certain plugins, you can disable the others in the ./configure command (check the --help for the syntax for that).

./configure
make -j 5
sudo make install

Shared-Library requirements for MythTV

The runtime manager for shared libraries, /lib/ld.so, gets information about the locations and contents of shared libraries from /etc/ld.so.cache, a file created by ldconfig from information in /etc/ld.so.conf. Because MythTV installs shared libraries in /usr/local/lib, that directory needs to be added to the list of directories for ld.so to search when doing runtime linking of programs, if it is not already there. You do this, as root, by editing /etc/ld.so.conf, then running ldconfig. There are many ways to do this; to determine the way that your distribution is configured, type:

cat /etc/ld.so.conf
cat /etc/ld.so.conf.d/*

Check if /usr/local/lib is included in the list displayed. If so then no action is needed.

If /usr/local/lib is not already included, then create as root a file under /etc/ld.so.conf.d that contains a line containing

/usr/local/lib

Make sure that /etc/ld.so.conf contains a line as follows

include /etc/ld.so.conf.d/*.conf

To ensure the cache has been updated, run this command:

sudo /sbin/ldconfig

Test Setup

Instead of setting up the shared library cache as described above, if you have customized the location of the libraries using for example ./configure --prefix=/home/peter/work/mythtv, you can install and run the backend and frontend in your home directory by setting the path of the lib files as follows:

export LD_LIBRARY_PATH=/home/peter/work/mythtv/lib
export PATH="$PATH:/home/peter/work/mythtv/bin"

Install MythWeb

If you plan to run MythWeb, install it on your master backend server. Install the dependencies, listed above. Check out Mythweb from git:

Step Command to run
clone cd ~/build
git clone https://github.com/MythTV/mythweb.git mythweb
cd mythweb
Check versions available git branch -a
Choose your version. The current stable released version is 33-fixes. We recommend to use that version. git checkout fixes/0.xx

Set up the web application as follows:

cd ~/build/mythweb/
sudo cp -r ~/build/mythweb /usr/local/share/mythtv/mythweb
sudo ln -s /usr/local/share/mythtv/mythweb/ /var/www/html/
sudo cp -v /usr/local/share/mythtv/mythweb/mythweb.conf.apache /etc/apache2/sites-available/mythweb.conf

Edit file /etc/apache2/sites-available/mythweb.conf using gedit or vi, for example:

sudo vi /etc/apache2/sites-available/mythweb.conf

Change the lines containing <Directory "/var/www/html/data"> and <Directory "/var/www/html" > so that they read <Directory "/var/www/html/mythweb/data"> and <Directory "/var/www/html/mythweb" >, i.e. add the mythweb subdirectory.

sudo a2enmod rewrite
sudo a2ensite mythweb.conf
sudo chown -R www-data:www-data /usr/local/share/mythtv/mythweb/data/
sudo chmod -R g+w /usr/local/share/mythtv/mythweb/data/

Restart your apache server as follows to get the changes applied:

sudo /etc/init.d/apache2 restart

the database and backend must be running for MythWeb to work. At this point you have not yet set up the database or the backend so you cannot try MythWeb. Once those things have been set up and are running, test MythWeb by navigating to http://servername/mythweb where servername is your master backend server on which mythweb is running. If running from a different system you may have to add servername plus its ip address to your /etc/hosts file.

For more advanced and detailed instructions on MythWeb see the file mythweb/INSTALL in the download from github.

Post-install tasks

After installing the software there are a number of steps that must be taken before you have a working environment. If you installed from a pre-built package these would be done automatically.

Creating the mythtv user

MythTV backend needs to run as its own user. This should be a system account. Create a user as follows:

sudo useradd --system mythtv

Users might want to add --groups cdrom,audio,video to the above.

MythTV Database Setup

Run these commands from the command line. The mysql command will prompt for your root database password, which you would have supplied during mysql installation. The mysql daemon must be running.

mysql -u root -p
create database mythconverg;
create user 'mythtv'@'%' identified by 'mythtv';
create user 'mythtv'@'localhost' identified by 'mythtv';
set password for 'mythtv'@'%' = password('mythtv');
set password for 'mythtv'@'localhost' = password('mythtv');
connect mythconverg;
grant all privileges on *.* to 'mythtv'@'%' with grant option;
grant all privileges on *.* to 'mythtv'@'localhost' with grant option;
flush privileges;
exit;

Run the following command to set up time zone tables:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Run mythbackend. This will automatically create your database or upgrade your previous mythconverg database schema to the latest version:

mythbackend

mythbackend will start up and create the database tables, after which it will shut down. Further attempts to start it will result in a message as follows:

 E  Scheduler: No capture cards are defined in the database.
 Perhaps you should re-read the installation instructions?

If there are problems with the database, see the article Database Setup.

Before you can get the backend to start up and stay running, you have to configure at least one capture card correctly, plus one video source and connect these with an input. See Configuring_MythTV. Note that if you had installed the Ubuntu pre-built package there would not be this restriction, the backend can run without any configuration being done.

Backend Startup

For MythTV to be able to schedule and make recordings, the backend must be running at the time of the scheduled recordings. Normally this means running the backend at all times while the server is running. It should be set up to be automatically started when the server starts. This is handled automatically for you in the pre-built packages, but if you are building it yourself you have to set up some mechanism. Possible ways of doing it are systemd, Upstart, init script, /etc/rc.local. Ubuntu packages run it from Upstart (but is likely to switch to systemd in 16.04), which has the ability to restart the process if it fails.

The simplest way will be by editing the rc.local. Use gksudo gedit to edit rc.local and add the following line:

/usr/local/bin/mythbackend -d --logpath /tmp/ --user mythtv

This is a very basic and simplistic approach, but will work. For a reliable system you need to use something more advanced like Upstart. If you install from the Ubuntu or MythBuntu package the Upstart setup is done for you. Also you should create a directory other than /tmp/ for your logs. /var/log/mythtv is the popular location. Note that whatever directory you create for logs must be writeable by the mythtv user as well as frontend users. The frontend user if your normal Linux login, which you will use for viewing MythTV.

You can get a list of options available with mythbackend by running mythbackend --help.

If the backend starts up before you have added any capture cards it will immediately shut down again. Proceed to Configuring MythTV and complete the configuration up to the point of setting up a capture card, a video source and an input connection, before trying to start it again.

Next Steps

At this point you need to perform the configuration steps. See the table of contents and proceed to Configuring_MythTV and then Configuring_Frontend. Until you have done that you will not be able to do anything useful with MythTV.