Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
file 392 lines (270 sloc) 12.637 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
This is the INSTALL file for the MythWeb package. It contains the installation
requirements and instructions for MythWeb. Please see README for other
information.

June 6, 2010

========
Contents
========

1.0 Requirements
2.0 Source
3.0 Experts
4.0 Everyone Else
4.1 Install Overview
4.2 Permissions
4.3 Webserver
5.0 Apache
5.1 Apache Config
5.2 Apache Security Config
6.0 Lighttpd
7.0 PHP

=======
Summary
=======

PLEASE, PLEASE read this document. People seem to skip over this, under the
mistaken assumption that MythWeb will just work with no configuration. While
we've tried to make it as auto-detecting as possible, it usually still needs
some hand-editing to account for variances in install preferences, etc.

Please also read the FAQ in the README file, since it answers several common
post-install questions/concerns.

================
1.0 Requirements
================

First of all, you need MythTV, which you should be able to track down at:

    http://www.mythtv.org

In addition to all the various things required to get MythTV up and running
(which are documented in the main MythTV source), you need Apache, Perl and PHP
up and running on either the same machine as MythTV, or one that is not blocked
from communication by a firewall:

    http://www.apache.org
    http://www.php.net
    http://www.perl.com/

Current versions of these in use by the MythWeb developer(s) are 2.2.x for
Apache, 5.3.x for PHP, and 5.8.x for Perl. Make sure to build both Apache and
PHP according to the instructions at the PHP home site, and be sure to include
support for session, MySQL, pcre, posix and json when building PHP.

It is also possible to use MythWeb with Lighttpd (Lighty):

    http://www.lighttpd.net/

PHP Requirements:


PHP Optionals:
Sockets (UPnP Auto Discovery)

==========
2.0 Source
==========

There are two official ways to download MythWeb. You can either download it as
part of the MythPlugins tarball from http://www.mythtv.org/ or you can grab it
directly from a subversion checkout, as described at http://svn.mythtv.org/trac

Regardless of which method you end up choosing, you should be left with a
directory named mythweb, which contains mythweb.php, mythweb.pl and a handful
of other files/directories (including this file).

* Note, if you would like to check out ONLY MythWeb, you could do something
like the following:

    svn co http://svn.mythtv.org/svn/branches/release-##-fixes/mythplugins/mythweb

Where ## is replaced with the version you want. For instance for the 0.21
release, replace it with "0-21".

===========
3.0 Experts
===========

If you are not an expert, please skip to section 4.0. Experts, the following
commands should be enough for you to figure out what's going on:

    cp -r mythplugins/mythweb/* /var/www/html/

    vi /var/www/html/mythweb.conf.apache

    mv /var/www/html/mythweb.conf.apache /etc/httpd/conf.d/mythweb.conf

    /etc/init.d/httpd restart

=================
4.0 Everyone Else
=================

If you are reading this section, we're going to assume that you have only
minimal experience configuring both Linux and a webserver. For those of
you somewhere in between novice and expert, we hope that you do not find
the following sections too boring, but please pay attention in case you
overlook something important.

====================
4.1 Install Overview
====================

Most people will be running their MythWeb installation on the same system that
hosts the MythTV backend server, and will not be running any other web services,
so we will be expecting that you will want to access your machine directly,
like:

    http://192.168.0.50/

The second most common situation would look something like this:

    http://192.168.0.50/mythweb/

The differences between these situations are trivial, and if you cannot figure
out how to do the second location from this guide, please don't hesitate to
drop into #mythtv-users on irc.freenode.net to ask for help.

For the purpose of this guide, we will assume that you want to access your
machine directly (first situation above) and that your Apache document root
directory is:

    /var/www/html

This is not the case on every system, and you may find that your chosen
distribution has placed it somewhere else, e.g.:

    /home/www/htdocs
    /var/apache
    /var/www
    /var/www/htdocs

Once you figure out where your copy of Apache is looking for files, copy your
MythWeb files into that directory:

    cd mythplugins/mythweb
    cp -R * /var/www/html/

===============
4.2 Permissions
===============

The next thing you need to do is make sure that your web server can write to
MythWeb's data directory. This should be as simple as:

    chgrp -R apache /var/www/html/data
    chmod g+rw /var/www/html/data

Please note that different distributions use a different userid for Apache
(e.g. Ubuntu uses www-data). Please be aware that you may need to consult
Apache's httpd.conf (often found at /etc/httpd/httpd.conf) file to verify which
user/group Apache is set to run as.

As a last resort, you can make the directory world-writable:

    chmod a+rw /var/www/html/data

However, I strongly discourage this, since it is a slight security concern to
give write permissions to any arbitrary user on your system.

In order for MythWeb to display channel icons, they must exist in a directory
that MythWeb can access. Many current distributions create user home
directories with permissions of 700, which will stop MythWeb from being able
to access icons located in a user's ~/.mythtv/channels directory. The location
of each channel's icon is stored in the MythTV database.

In order to resolve this issue, icons can be manually copied to MythWeb's
data/tv_icons directory and chown'd to apache:apache. Another method to provide
access to icons located within a user's home directory is to alter the
permission of the home directory itself. Older distributions have used 0755
permissions, however this represents a large security risk as all other users
on the system will have read access to that user's home directory, so it is not
recommended.

=============
4.3 Webserver
=============

As of 0.21, MythWeb contains configuration files for both Apache and Lighty.
You will need to choose ONE of these files and install it in your webserver's
configuration directory. This will be explained later.

The first thing you must do is find the configuration file for your chosen
webserver, and then follow the instructions in the appropriate subsection:

    mythweb.conf.apache (See section 5.0)
    mythweb.conf.lighttpd (See section 6.0)

Please do not use Lighttpd unless you know what you are doing.

==========
5.0 Apache
==========

MythWeb relies on two Apache modules that are sometimes built in or
enabled by default:

    mod_env
    mod_rewrite

If you compiled Apache yourself, or are experiencing server trouble loading
MythWeb, please make sure that these are enabled.

There are also three documented sections in the conf file that are disabled by
default, but I strongly recommend that you enable. They require:

    mod_deflate
    mod_headers
    mod_auth_digest

To enable these on most systems "a2enmod" will work, for instance on
Ubuntu you need to type these commands before MythWeb will work:

    a2enmod rewrite
    a2enmod deflate
    a2enmod headers
    a2enmod auth_digest

=================
5.1 Apache Config
=================

The directions below will have you set up MythWeb without any authentication
at first, make sure you disconnect the machine from the network for these
steps. For most this will work:

    ifdown eth0

But you can also just unplug the network cable temporarily.

First, open mythweb.conf.apache in your favorite editor and look for what
should be the first non-comment line in the file:

    <Directory "/var/www/html/data" >

You should change that path to match MythWeb's data directory. It is a
subdirectory within the directory you copied the MythWeb files to above in
section 4.1. The purpose of this Directory section is to place specific
restrictions on MythWeb's data directory.

The following <Directory> section is for the main MythWeb installation
directory:

    <Directory "/var/www/html" >

As before, you should change that path to match the directory that you installed
MythWeb into (but this time to the MythWeb root directory).

Continue on in the file and find the following lines:

    setenv db_server "localhost"
    setenv db_name "mythconverg"
    setenv db_login "mythtv"
    setenv db_password "mythtv"

You should update these so that they match the settings required to connect to
your MythTV database server.

There are other settings in this file, too, which should be fairly well
documented. Please read through the comments in the file itself to see if you
can benefit from features that are disabled by default, or settings required
for some of the more exotic installation possibilities.

Finally, you should put this file into Apache's "extra config files" directory.
On Fedora, this is:

    /etc/httpd/conf.d/

Other distributions might use something like:

    /etc/apache/conf.d/
    /etc/apache2/conf.enabled.d/

Generally if a /etc/apache2/sites-available or similar directory exists you
will want to place this file there and then run:

    a2ensite mythweb.conf

You will have to figure out the correct path on your own, but once you do, move
the MythWeb config file into place like so:

    mv mythweb.conf.apache /etc/apache2/conf.d/mythweb.conf

Then start/restart Apache with:

    /etc/init.d/apache2 stop
    /etc/init.d/apache2 start

(or similar, this depends on the distribution).

At this stage, you should be able to open MythWeb in a browser on the machine
on which you installed it by opening

    http://192.168.0.50/

If MythWeb does not load or you receive an error, please review the settings
in the mythweb.conf file, the MythWeb README file, and this document for any
potential mistakes you may have made. Please read the next section before
re-enabling the network. If you still can't get it to work, disable Apache,
using something like:

    /etc/init.d/apache2 stop

Then re-enable the network using:

    ifup eth0

or by plugging the network cable back in, depending on how you disabled it
earlier. Now google for the error message you see at the end of:

    tail /var/log/apache2/error.log

or similarly named error log for Apache. Chances are someone else has
had the same problem before and found a solution.

==========================
5.2 Apache Security Config
==========================

The next step is to make sure everyone in the world can't take over your
machine and that web crawlers don't automatically delete all your recordings.

In the mythweb.conf file there is an authentication section. For this
to work you will need to run this for the first user:

    htdigest -c /etc/mythweb.password.digest MythTV username

And this for each additional user:

    htdigest /etc/mythweb.password.digest MythTV username

Uncomment all the directives in this section of the file and change
/var/www/htdigest to /etc/mythweb.password.digest or whatever else
you want to call the password file. Do not place the file anywhere
below /var/www or it will be world accessible. /var/www/htdigest
would be the absolute worst name to use, since it appears in the
MythWeb documentation which the bad guys read for easy breakins.

The next step is to reload Apache so it can use the new configuration:

    /etc/init.d/apache2 stop
    /etc/init.d/apache2 start

(or similar, this depends on the distribution).

Now when you access the MythWeb pages, it should prompt you for a username
and a password. Type these in and make sure things work.

OK, if you reached this step you are almost done! Just plug in the network cable
or type "ifup eth0" if you used "ifdown eth0" to disable the network earlier.

============
6.0 Lighttpd
============

Sorry, no documentation here yet...

=======
7.0 PHP
=======

PHP tries to determine the system's local timezone settings automatically
but may not be successful on every distribution. To ensure that PHP uses
the correct timezone, edit php.ini and configure the date.timezone variable
to your local timezone.

For example, to set the PHP timezone to Europe/London:

    vim /etc/php.ini

add/uncomment the date.timezone variable:

    date.timezone = Europe/London

and then restart Apache (exact commands depend on distribution):

    /etc/init.d/apache2 stop
    /etc/init.d/apache2 start
Something went wrong with that request. Please try again.