Difference between revisions of "HOWTO backup and install the GlueX wiki"

From GlueXWiki
Jump to: navigation, search
(change mediawiki version in examples to 1.17.0)
Line 27: Line 27:
 
4. Move files from backup directory into wiki directory
 
4. Move files from backup directory into wiki directory
 
  > cp -rp wiki_backup_13-10-09/* wiki
 
  > cp -rp wiki_backup_13-10-09/* wiki
 +
5. You may need to change permissions on the images directory (and subdirs) so that the web server can add and modify files there.
 +
> chmod -R o+w wiki/images
  
 
=== Filling the Database ===
 
=== Filling the Database ===
Line 41: Line 43:
 
to this
 
to this
  
  $wgDBserver        = "localhost";
+
  $wgDBserver        = "127.0.0.1";
 
  $wgDBname          = "wikidb";
 
  $wgDBname          = "wikidb";
 
  $wgDBuser          = "www";
 
  $wgDBuser          = "www";
Line 61: Line 63:
 
3. Fill the database using the wikidb.sql file
 
3. Fill the database using the wikidb.sql file
 
  >mysql -u www wikidb < wikidb.sql
 
  >mysql -u www wikidb < wikidb.sql
 +
 +
 +
== Troubleshooting ==
 +
=== No images ===
 +
When I first installed the wiki on my laptop (Macbook Pro, OS X 10.7.5) the images would not come up and I could see this message in the error log:
 +
 +
>tail /var/log/apache2/error_log
 +
[Sat Oct 12 20:19:55 2013] [error] [client fe80::1] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /Users/davidl/Sites/wiki/images/thumb/8/80/Gluex-eng1.png/300px-Gluex-eng1.png, referer: http://localhost/~davidl/wiki/index.php/Main_Page
 +
 +
After some head scratching and web searching, it turns out the problem is due to some reduced permissions being set in a ''.htaccess'' file in the images directory. This file looks to be distributed with MediaWiki to address a security bug. The solution was found [http://www.userdel.org/?p=76 here] which said to add a ''"Options FollowSymLinks"'' line to the ''.htaccess'' file. Here's what mine looked like after I added it and images started working:
 +
 +
# Protect against bug 28235
 +
<IfModule rewrite_module>
 +
Options FollowSymLinks
 +
RewriteEngine On
 +
RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
 +
RewriteRule . - [forbidden]
 +
</IfModule>

Revision as of 21:39, 12 October 2013

Here are instructions for backing up the GlueX wiki and reinstalling it at another location. This is motivated by the ongoing US Federal Government shutdown of 2013 that may cause JLab to close temporarily. To avoid complete disruption to the collaboration, we are preparing to move it to the URegina server temporarily.


Technical details

The GlueX wiki uses MediaWiki with a MySQL database for the backend. The wiki is hosted at JLab with these settings:

  • host = halldweb1.jlab.org (webserver and MySQL server)
  • dbname = wikidb
  • mysql user = wiki


Backing up the wiki

Restoring the wiki

Before starting, you'll need to get your PHP-enabled web-sever up and running as well as you MySQL database. Once those are working, go to the directory where the wiki pages will be served from and follow these steps:

Unpacking the files

1. Unpack MediaWiki

> tar xzvf mediawiki-1.17.0.tar.gz

2. Rename "mediawiki-X" directory to "wiki"

> mv mediawiki-1.17.0 wiki

3. Unpack tarball from GlueX wiki backup

> tar xzvf wiki_backup_13-10-09.tgz

4. Move files from backup directory into wiki directory

> cp -rp wiki_backup_13-10-09/* wiki

5. You may need to change permissions on the images directory (and subdirs) so that the web server can add and modify files there.

> chmod -R o+w wiki/images

Filling the Database

Prior to filling the database, you need to make sure you have an account there that the webserver can write to.

1. Edit the file wiki/LocalSettings.php to set the connection parameters for the database (look for the string wgDBserver). For example, to install this on my laptop I changed this :

$wgDBserver         = "halldweb1.jlab.org";
$wgDBname           = "wikidb";
$wgDBuser           = "wiki";
$wgDBpassword       = "wiki";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

to this

$wgDBserver         = "127.0.0.1";
$wgDBname           = "wikidb";
$wgDBuser           = "www";
$wgDBpassword       = "";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

2. Create the wikidb database on the server

> mysql -u www
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.1.43 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wikidb;
mysql> quit

3. Fill the database using the wikidb.sql file

>mysql -u www wikidb < wikidb.sql


Troubleshooting

No images

When I first installed the wiki on my laptop (Macbook Pro, OS X 10.7.5) the images would not come up and I could see this message in the error log:

>tail /var/log/apache2/error_log
[Sat Oct 12 20:19:55 2013] [error] [client fe80::1] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /Users/davidl/Sites/wiki/images/thumb/8/80/Gluex-eng1.png/300px-Gluex-eng1.png, referer: http://localhost/~davidl/wiki/index.php/Main_Page

After some head scratching and web searching, it turns out the problem is due to some reduced permissions being set in a .htaccess file in the images directory. This file looks to be distributed with MediaWiki to address a security bug. The solution was found here which said to add a "Options FollowSymLinks" line to the .htaccess file. Here's what mine looked like after I added it and images started working:

# Protect against bug 28235
<IfModule rewrite_module>
	Options FollowSymLinks
	RewriteEngine On
	RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
	RewriteRule . - [forbidden]
</IfModule>