ISFDB:Full Linux Website

From ISFDB
Jump to navigation Jump to search

Setting up an ISFDB Web server

1. Follow the instructions at ISFDB:Personal Linux Website. This will handle everything except the Wiki setup.

2. Download the versions of the PHP and MediaWiki packages listed on Special:Version.

3. Install PHP.

4. Place the MediaWiki package in the Apache directory. In a typical install this would be /var/www. Extract the files by executing: tar -xvf mediawiki-version.tar . Rename the directory: mv mediawiki-version wiki

5. Modify wiki/LocalSettings.php. Make the following changes/additions:

$IP = "/var/www/wiki";
$wgSitename        = "ISFDB";
$wgScriptPath      = "/wiki";
$wgLogo            = "$wgStylePath/common/images/isfdb.gif";
$wgEmergencyContact = "somebody@email_account.com";
$wgPasswordSender   = "postmaster@your_host_name";
$wgDBserver         = "localhost";
$wgDBname           = "isfdb";
$wgDBuser           = "root";
$wgDBpassword       = "";
$wgDBprefix         = "mw_";
$wgGroupPermissions['*']['edit'] = false;
$wgSpamRegex = "/\<.*style.*?(display|position|overflow|visibility|height)\s*:.*?>/i";
$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/licenses/by/2.0/";
$wgRightsText = "Attribution";
$wgRightsIcon = "http://creativecommons.org/images/public/somerights20.gif";
$wgAllowExternalImages = true;
$wgServer = "http://www.isfdb.org";
$wgExtraNamespaces[100] = "Author";
$wgExtraNamespaces[101] = "Author_talk";
$wgExtraNamespaces[102] = "Bio";
$wgExtraNamespaces[103] = "Bio_talk";
$wgExtraNamespaces[104] = "Fanzine";
$wgExtraNamespaces[105] = "Fanzine_talk";
$wgExtraNamespaces[106] = "Magazine";
$wgExtraNamespaces[107] = "Magazine_talk";
$wgExtraNamespaces[108] = "Publication";
$wgExtraNamespaces[109] = "Publication_talk";
$wgExtraNamespaces[110] = "Publisher";
$wgExtraNamespaces[111] = "Publisher_talk";
$wgExtraNamespaces[112] = "Series";
$wgExtraNamespaces[113] = "Series_talk";
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );

6. Upgrade the Wiki if necessary.

  • Modify AdminSettings.php with the mysql username and password
  • In wiki/extensions install the ConfirmEdit extension
  • cd wiki/maintenance execute: php update.php

7. Create a "robots.txt" file with the following contents:

#User-agent: *
#Disallow: /
#
#User-Agent: Googlebot

User-Agent: *
Disallow: /cgi-bin/adv_search_results.cgi*
Disallow: /cgi-bin/se.cgi*
Disallow: /cgi-bin/edit/
Disallow: /cgi-bin/mod/
Disallow: /cgi-bin/diffselect*
Disallow: /cgi-bin/recent*
Disallow: /cgi-bin/user*
Disallow: /cgi-bin/my*
Disallow: /cgi-bin/search*
Disallow: /cgi-bin/stats*
Crawl-delay: 3
Request-rate: 1/3

Put robots.txt in the root directory of your domain and set permissions to 644. Check that it is accessible by browsers by pointing your browser at https://isfdb.org/robots.txt where "isfdb.org" is your domain name. The browser should display the data listed above. If the data is not displayed, robots.txt is in the wrong directory or has invalid permissions.

8. Set up daily backups and weekly image backups. Edit /etc/crontab and enter the following lines:

# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
40    04    *     *    0   root /home/ahasuerus/backup/images-1.sh > /home/ahasuerus/images1.log 2>&1
40    04    *     *    1   root /home/ahasuerus/backup/images-2.sh > /home/ahasuerus/images2.log 2>&1
30    09    *     *    *   root /home/ahasuerus/backup/backup.sh > /home/ahasuerus/daily_backup.log 2>&1

where "/home/ahasuerus/backup" is the directory where the backup shell scripts reside. Their contents should be as follows:

/home/ahasuerus/backup/images-1.sh :

rm /home/ahasuerus/images/im*.tar
/bin/tar -cf /home/ahasuerus/images/images-0.tar /var/www/html/wiki/images/0
/bin/tar -cf /home/ahasuerus/images/images-1.tar /var/www/html/wiki/images/1
/bin/tar -cf /home/ahasuerus/images/images-2.tar /var/www/html/wiki/images/2
/bin/tar -cf /home/ahasuerus/images/images-3.tar /var/www/html/wiki/images/3
/bin/tar -cf /home/ahasuerus/images/images-4.tar /var/www/html/wiki/images/4
/bin/tar -cf /home/ahasuerus/images/images-5.tar /var/www/html/wiki/images/5
/bin/tar -cf /home/ahasuerus/images/images-6.tar /var/www/html/wiki/images/6
/bin/tar -cf /home/ahasuerus/images/images-7.tar /var/www/html/wiki/images/7
/bin/tar -cf /home/ahasuerus/images/images-8.tar /var/www/html/wiki/images/8
/bin/tar -cf /home/ahasuerus/images/images-9.tar /var/www/html/wiki/images/9
chown ahasuerus:ahasuerus /home/ahasuerus/images/im*.tar

/home/ahasuerus/backup/images-2.sh :

rm /home/ahasuerus/images/im*.tar
/bin/tar -cf /home/ahasuerus/images/images-a.tar /var/www/html/wiki/images/a
/bin/tar -cf /home/ahasuerus/images/images-b.tar /var/www/html/wiki/images/b
/bin/tar -cf /home/ahasuerus/images/images-c.tar /var/www/html/wiki/images/c
/bin/tar -cf /home/ahasuerus/images/images-d.tar /var/www/html/wiki/images/d
/bin/tar -cf /home/ahasuerus/images/images-e.tar /var/www/html/wiki/images/e
/bin/tar -cf /home/ahasuerus/images/images-f.tar /var/www/html/wiki/images/f
/bin/tar -cf /home/ahasuerus/images/images-archive.tar /var/www/html/wiki/images/archive
/bin/tar -cf /home/ahasuerus/images/images-temp.tar /var/www/html/wiki/images/temp
/bin/tar -cf /home/ahasuerus/images/images-tmp.tar /var/www/html/wiki/images/tmp
/bin/tar -cf /home/ahasuerus/images/images-thumb.tar /var/www/html/wiki/images/thumb
/bin/tar -cf /home/ahasuerus/images/images-svgcode.tar /var/www/html/wiki/images/svgcode
chown ahasuerus:ahasuerus /home/ahasuerus/images/im*.tar

/home/ahasuerus/backup/backup.sh :

rm -f /home/ahasuerus/images/im*.tar
cd /home/ahasuerus/backup
rm -f dbdump.gz
/usr/bin/mysqldump -h localhost -u root --ignore-table=isfdb.mw_objectcache isfdb > dbdump
/bin/gzip dbdump
/bin/chown ahasuerus:ahasuerus dbdump.gz
/bin/chmod 600 dbdump.gz