Ticket #6721: 6721-mythweb-install-doc.diff

File 6721-mythweb-install-doc.diff, 14.2 KB (added by Nick Morrott <knowledgejunkie (at) gmail (dot) com>, 15 years ago)

INSTALL updates

  • mythplugins/mythweb/INSTALL

     
    22requirements and instructions for MythWeb.  Please see README for other
    33information.
    44
    5 October 26, 2008
     5July 13, 2009
    66
    77========
    88Contents
     
    17174.3         Webserver
    18185.0     Apache
    19195.1         Apache Config
     205.2         Apache Security Config
    20216.0     Lighttpd
    21227.0     PHP
    2223
     
    4142    http://www.mythtv.org
    4243
    4344In addition to all the various things required to get MythTV up and running
    44 (which are documented in the main MythTV source), you need apache, perl and php
     45(which are documented in the main MythTV source), you need Apache, Perl and PHP
    4546up and running on either the same machine as MythTV, or one that is not blocked
    4647from communication by a firewall:
    4748
     
    5051    http://www.perl.com/
    5152
    5253Current versions of these in use by the MythWeb developer(s) are 2.2.x for
    53 Apache, 5.1.x for php, and 5.8.x for perl. Make sure to build both apache and
    54 php according to the instructions at the php home site, and be sure to include
     54Apache, 5.1.x for PHP, and 5.8.x for Perl.  Make sure to build both Apache and
     55PHP according to the instructions at the PHP home site, and be sure to include
    5556support for MySQL when building PHP.
    5657
    5758It is also possible to use MythWeb with Lighttpd (Lighty):
     
    6364==========
    6465
    6566There are two official ways to download MythWeb.  You can either download it as
    66 part of the MythPlugins tarball from http://mythtv.org/ or you can grab it
     67part of the MythPlugins tarball from http://www.mythtv.org/ or you can grab it
    6768directly from a subversion checkout, as described at http://svn.mythtv.org/trac
    6869
    6970Regardless of which method you end up choosing, you should be left with a
     
    99100
    100101If you are reading this section, we're going to assume that you have only
    101102minimal experience configuring both Linux and a webserver.  For those of
    102 you somewhere in between novice an expert, we hope that you do not find
     103you somewhere in between novice and expert, we hope that you do not find
    103104the following sections too boring, but please pay attention in case you
    104105overlook something important.
    105106
     
    116117
    117118The second most common situation would look something like this:
    118119
    119     http://192.168.0.51/mythweb/
     120    http://192.168.0.50/mythweb/
    120121
    121122The differences between these situations are trivial, and if you cannot figure
    122123out how to do the second location from this guide, please don't hesitate to
    123124drop into #mythtv-users on irc.freenode.net to ask for help.
    124125
    125 For the purpose of this guide, we will generally assume that your apache
    126 document root directory is:
     126For the purpose of this guide, we will assume that you want to access your
     127machine directly (first situation above) and that your Apache document root
     128directory is:
    127129
    128130    /var/www/html
    129131
    130132This is not the case on every system, and you may find that your chosen
    131 distribution has placed it somewhere else.  e.g.
     133distribution has placed it somewhere else, e.g.:
    132134
    133135    /home/www/htdocs
    134136    /var/apache
    135137    /var/www
    136138    /var/www/htdocs
    137139
    138 For the purposes of illustration, we're going to use the imaginary /web/htdocs
    139 directory to refer to your installation directory.
     140Once you figure out where your copy of Apache is looking for files, copy your
     141MythWeb files into that directory:
    140142
    141 Once you figure out where your copy of apache is looking for files, copy your
    142 mythweb files into that directory:
    143 
    144143    cd mythplugins/mythweb
    145     cp -R * /web/htdocs/
     144    cp -R * /var/www/html/
    146145
    147146===============
    1481474.2 Permissions
     
    151150The next thing you need to do is make sure that your web server can write to
    152151MythWeb's data directory.  This should be as simple as:
    153152
    154     chgrp -R apache /web/htdocs/data
    155     chmod g+rw /web/htdocs/data
     153    chgrp -R apache /var/www/html/data
     154    chmod g+rw /var/www/html/data
    156155
    157 Please note that different distributions use a different userid for apache
     156Please note that different distributions use a different userid for Apache
    158157(e.g. Ubuntu uses www-data).  Please be aware that you may need to consult
    159 apache's httpd.conf (often found at /etc/httpd/httpd.conf) file to verify which
    160 user/group apache is set to run as.
     158Apache's httpd.conf (often found at /etc/httpd/httpd.conf) file to verify which
     159user/group Apache is set to run as.
    161160
    162161As a last resort, you can make the directory world-writable:
    163162
    164     chmod a+rw /web/htdocs/data
     163    chmod a+rw /var/www/html/data
    165164
    166165However, I strongly discourage this, since it is a slight security concern to
    167166give write permissions to any arbitrary user on your system.
    168167
     168In order for MythWeb to display channel icons, they must exist in a directory
     169that MythWeb can access. Many current distributions create user home
     170directories with permissions of 700, which will stop MythWeb from being able
     171to access icons located in a user's ~/.mythtv/channels directory. The location
     172of each channel's icon is stored in the MythTV database.
     173
     174In order to resolve this issue, icons can be manually copied to MythWeb's
     175data/tv_icons directory and chown'd to apache:apache. Another method to provide
     176access to icons located within a user's home directory is to alter the
     177permission of the home directory itself. Older distributions have used 0755
     178permissions, however this represents a large security risk as all other users
     179on the system will have read access to that user's home directory, so it is not
     180recommended.
     181
    169182=============
    1701834.3 Webserver
    171184=============
    172185
    173 As of 0.21, MythWeb contains configuration files for both Apache and Lighty. You
    174 will need to chose ONE of these files and install it in your webserver's
    175 configuration directory.  I will explain this later.
     186As of 0.21, MythWeb contains configuration files for both Apache and Lighty.
     187You will need to chose ONE of these files and install it in your webserver's
     188configuration directory.  This will be explained later.
    176189
    177190The first thing you must do is find the configuration file for your chosen
    178 webserver, and then follow the instructions in the appropriate subsection
     191webserver, and then follow the instructions in the appropriate subsection:
    179192
    180193    mythweb.conf.apache         (See section 5.0)
    181194    mythweb.conf.lighttpd       (See section 6.0)
     
    1861995.0 Apache
    187200==========
    188201
    189 MythWeb relies on two apache modules that are sometimes built in or
     202MythWeb relies on two Apache modules that are sometimes built in or
    190203enabled by default:
    191204
    192205    mod_env
    193206    mod_rewrite
    194207
    195 If you compiled apache yourself, or are experiencing server trouble loading
     208If you compiled Apache yourself, or are experiencing server trouble loading
    196209MythWeb, please make sure that these are enabled.
    197210
    198211There are also three documented sections in the conf file that are disabled by
     
    204217
    205218To enable these on most systems "a2enmod" will work, for instance on
    206219Ubuntu you need to type these commands before MythWeb will work:
     220
    207221    a2enmod rewrite
    208222    a2enmod deflate
    209223    a2enmod headers
     
    215229
    216230The directions below will have you set up MythWeb without any authentication
    217231at first, make sure you disconnect the machine from the network for these
    218 steps. For most this will work:
    219   ifdown eth0
     232steps.  For most this will work:
     233
     234    ifdown eth0
     235
    220236But you can also just unplug the network cable temporarily.
    221237
    222238First, open mythweb.conf.apache in your favorite editor and look for what
    223239should be the first non-comment line in the file:
    224240
     241    <Directory "/var/www/html/data" >
     242
     243You should change that path to match MythWeb's data directory.  It is a
     244subdirectory within the directory you copied the MythWeb files to above in
     245section 4.1.  The purpose of this Directory section is to place specific
     246restrictions on MythWeb's data directory.
     247
     248The following <Directory> section is for the main MythWeb installation
     249directory:
     250
    225251    <Directory "/var/www/html" >
    226252
    227 You should change that path to match the document root directory you discovered
    228 in section 4.0, such that it might look something like:
     253As before, you should change that path to match the directory that you installed
     254MythWeb into (but this time to the MythWeb root directory).
    229255
    230     <Directory "/web/htdocs" >
    231 
    232256Continue on in the file and find the following lines:
    233257
    234258    setenv db_server        "localhost"
     
    237261    setenv db_password      "mythtv"
    238262
    239263You should update these so that they match the settings required to connect to
    240 your MythTV master backend.
     264your MythTV database server.
    241265
    242266There are other settings in this file, too, which should be fairly well
    243267documented.  Please read through the comments in the file itself to see if you
    244268can benefit from features that are disabled by default, or settings required
    245269for some of the more exotic installation possibilities.
    246270
    247 Finally, you should put this file into apache's "extra config files" directory.
     271Finally, you should put this file into Apache's "extra config files" directory.
    248272On Fedora, this is:
    249273
    250274    /etc/httpd/conf.d/
     
    254278    /etc/apache/conf.d/
    255279    /etc/apache2/conf.enabled.d/
    256280
    257 Generally if there /etc/apache2/sites-available or similar directory you
    258 want to place this there and then run:
     281Generally if a /etc/apache2/sites-available or similar directory exists you
     282will want to place this file there and then run:
    259283
    260284    a2ensite mythweb.conf
    261285
     
    264288
    265289    mv mythweb.conf.apache /etc/apache2/conf.d/mythweb.conf
    266290
    267 Then start/restart apache:
    268   /etc/init.d/apache2 stop
    269   /etc/init.d/apache2 start
    270 Or similar, this depends on the distribution.
     291Then start/restart Apache with:
    271292
    272 Now you should be able to load mythweb. If you do not please review the
    273 mythweb.conf file and this document for any potential mistakes you may
    274 have made. Please read the next section before re-enabling the network.
    275 If you still can't get it to work, disable apache, using something like:
     293    /etc/init.d/apache2 stop
     294    /etc/init.d/apache2 start
    276295
    277   /etc/init.d/apache2 stop
     296(or similar, this depends on the distribution).
    278297
     298At this stage, you should be able to open MythWeb in a browser on the machine
     299on which you installed it by opening
     300
     301    http://192.168.0.50/
     302
     303If MythWeb does not load or you receive an error, please review the settings
     304in the mythweb.conf file, the MythWeb README file, and this document for any
     305potential mistakes you may have made.  Please read the next section before
     306re-enabling the network.  If you still can't get it to work, disable Apache,
     307using something like:
     308
     309    /etc/init.d/apache2 stop
     310
    279311Then re-enable the network using:
    280312
    281   ifup eth0
     313    ifup eth0
    282314
    283 Or, plugging the network cable back in, depending on how you disabled it
    284 earlier. Now google for the error message you see at the end of:
     315or by plugging the network cable back in, depending on how you disabled it
     316earlier.  Now google for the error message you see at the end of:
    285317
    286   tail /var/log/apache2/error.log
     318    tail /var/log/apache2/error.log
    287319
    288 or similarly named error log for apache. Chances are someone else has
     320or similarly named error log for Apache. Chances are someone else has
    289321had the same problem before and found a solution.
    290322
    291 
    292323==========================
    2933245.2 Apache Security Config
    294325==========================
     
    296327The next step is to make sure everyone in the world can't take over your
    297328machine and that web crawlers don't automatically delete all your recordings.
    298329
    299 In the mythweb.conf file there is an authentication section. For this
     330In the mythweb.conf file there is an authentication section.  For this
    300331to work you will need to run this for the first user:
    301332
    302   htdigest -c /etc/mythweb.password.digest MythTV username
     333    htdigest -c /etc/mythweb.password.digest MythTV username
    303334
    304335And this for each additional user:
    305   htdigest /etc/mythweb.password.digest MythTV username
    306336
     337    htdigest /etc/mythweb.password.digest MythTV username
     338
    307339Uncomment all the directives in this section of the file and change
    308340/var/www/htdigest to /etc/mythweb.password.digest or whatever else
    309 you want to call the password file. Do not place the file anywhere
    310 below /var/www or it will be world accessible. /var/www/htdigest
     341you want to call the password file.  Do not place the file anywhere
     342below /var/www or it will be world accessible.  /var/www/htdigest
    311343would be the absolute worst name to use, since it appears in the
    312 mythweb documentation which the bad guys read for easy breakins.
     344MythWeb documentation which the bad guys read for easy breakins.
    313345
    314 The next step is to reload apache so it can use the new configuration:
    315   /etc/init.d/apache2 stop
    316   /etc/init.d/apache2 start
    317 Or similar, this depends on the distribution.
     346The next step is to reload Apache so it can use the new configuration:
    318347
    319 Now when you access the mythweb pages it should prompt you for a username
    320 and password. Type these in and make sure things work.
     348    /etc/init.d/apache2 stop
     349    /etc/init.d/apache2 start
    321350
    322 Ok, if you reached this step you are almost done! Just plug in the
    323 network cable or type "ifup eth0" if you used "ifdown eth0" to disable
    324 the network earlier.
     351(or similar, this depends on the distribution).
    325352
     353Now when you access the MythWeb pages, it should prompt you for a username
     354and a password.  Type these in and make sure things work.
     355
     356OK, if you reached this step you are almost done! Just plug in the network cable
     357or type "ifup eth0" if you used "ifdown eth0" to disable the network earlier.
     358
    326359============
    3273606.0 Lighttpd
    328361============
     
    334367=======
    335368
    336369PHP tries to determine the system's local timezone settings automatically
    337 but may not be successful on every distribution. To ensure that PHP uses
     370but may not be successful on every distribution.  To ensure that PHP uses
    338371the correct timezone, edit php.ini and configure the date.timezone variable
    339372to your local timezone.
    340373
    341374For example, to set the PHP timezone to Europe/London:
    342375
    343   vim /etc/php.ini
     376    vim /etc/php.ini
    344377
    345378add/uncomment the date.timezone variable:
    346379
    347   date.timezone = Europe/London
     380    date.timezone = Europe/London
    348381
    349382and then restart Apache (exact commands depend on distribution):
    350383
    351   /etc/init.d/apache2 stop
    352   /etc/init.d/apache2 start
    353 
     384    /etc/init.d/apache2 stop
     385    /etc/init.d/apache2 start