Wiki installation

From AardRock Wiki
Jump to: navigation, search

To create yet another MediaWiki on an existing server, sharing the same database engine and Apache configuration:

  • using a separate domain;
  • using a separate dbuser;
  • using a separate wikiname, where dbname=wikinamewiki;
  • using very short URLs.
  1. Register your domain and have DNS point to your hosting machine.
  2. Enable Plesk > Domains > domain > Setup > Services > PHP Support.
  3. Login on the server.
  4. Create a new database user, database and grant privileges accordingly:
    mysql -u root -p
    grant select, insert, update, delete, create on wikinamewiki.* to ' dbuser '@'localhost';
  5. Switch to the new domain:
    cd /var/www/vhosts/domain/httpdocs/.
  6. Unpack the MediaWiki archive:
    tar xvzf /srv/Z/mediawiki-1.6.2.tar.gz
  7. Temporarily make the config directory writable for all:
    chmod a+rwx config/
  8. Hop into your browser and visit http://domain/config/; this will bring up the Wiki configuration form and create LocalSettings.php as a result. NOTA BENE Make a note of all names and passwords.
  9. Revoke the create grant on the database:
    mysql -u root -p
    revoke create on dbname.* to ' dbuser '@'localhost';
  10. Move the resulting LocalSettings.php to the document root:
    mv config/LocalSettings.php .
  11. Edit LocalSettings.php to show:
    $wgScriptPath = "";
    $wgArticlePath = "$wgScriptPath/$1";
    $wgEnableUploads = true;
    # login to edit
    $wgGroupPermissions['*']['edit'] = false;
    $wgShowIPinHeader = false;
  12. Disable any subsequent confiration actions by removing write access on the config/ directory:
    chmod go=--- config/
  13. Only allow user wwwrun to be able te read LocalSettings.php—it contains the datbase user name and password:
    chmod go=--- LocalSettings.php
  14. Switch to the domain's Apache configuration directory:
  15. cd ../conf/
  16. Create the vhosts.conf file with the following contents:
    # Help Mediawiki's very short URLs work
    <Directory /var/www/vhosts/domain/httpdocs>
    Options FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]
  17. Include the following line at the end of /etc/apache2/httpd.include:
    Include /var/www/vhosts/
  18. Do a syntax check and any repair on your Apache configuration:
    /etc/init.d/apache2 configtest
  19. Restart Apache:
    /etc/init.d/apache2 restart

Done. Enjoy your new Wiki.

Short URLs