Creating a katlas mirror on a windows machine

From Knot Atlas
Jump to: navigation, search

Contents

Downloads

You'll need to download three things:

The Saint WAMP (a pre-built combination of Apache, MySQL and PHP, for windows.)
From http://sourceforge.net/projects/yawamp/
Get version 3.4 or greater (with PHP 5).
The katlas web site
The latest backup, created nightly, is at http://katlas.math.toronto.edu/backup/web-backup.tar.gz
You may want to begin downloading this while you install Saint; it's a big download (>200mb).
The katlas sql database
Again, the nightly backup is at http://katlas.math.toronto.edu/backup/wikidb-backup.sql.gz

(It is certainly possible to do this without Saint; I've successfully installed all the components separately in the past. --Scott 21:05, 4 Dec 2005 (EST))

Install Saint

Just run the executable. You can just accept all the default choices. (Although I'd recommend not installing filezilla or hamster.) In the last dialog box, you'll be given the option to start the service (selected by default). Do this!

(Troubleshooting - I installed Saint in a directory without spaces in the path; your results may vary.)

Configuring Saint

(See also the Saint README for further details.)

Start the content server

You should see in the system tray the Apache icon. If you'll double click on it, you'll see the Apache Service Monitor showing that the TSW-Controlserver is installed. We need to install the TSW-Contentserver as well.

Under the windows Start menu, find the TSW folder. Go to the WEB subfolder, and select 'TSW Contentserver install'. This should start the Apache Service Monitor. (If it doesn't, start it separately.) Now you'll see the TSW Contentserver. Click start!

(Troubleshooting - perhaps copy and paste the commandline of this shortcut, and run it from a commandline?) (Troubleshooting - the most likely cause of problems in getting Saint started is already having programs bound the ports 80 (http) and 443 (https). You can quickly check for this by typing netstat -a at the command line. Using netstat -a -b will (attempt) to give the name of executable which bound to each port. For example, for some reason Skype binds to ports 80 and 443, and I had to disable it before installing Saint.)

Change the document root (optional)

Open httpd.conf, and modify the DocumentRoot line. You'll also need to change the line <Directory htdocs> to something like <Directory "c:\path\to\DocumentRoot\">. Make sure you've created the directory, then restart the Contentserver service using the Apache Service Monitor.

Allow .htaccess files to rewrite URLs

katlas depends on a .htaccess file to specifying rewriting rules for URLs. By default, Saint doesn't allow .htaccess files to work. Edit the http.conf file (see above), and uncomment the line

#LoadModule rewrite_module modules/mod_rewrite.so

Also change the later line

   AllowOverride None

to

   AllowOverride All

You'll need to restart the Contentserver service.

Start the SQL database

Under the TSW folder in the start menu, go to the DB/MySQL folder, and run MyWinSQLAdmin. Enter whatever username and password you like to create the instance. The SQL administration program automatically minimises to the system tray, as a green traffic light.

Install katlas

Unpack the archives

Move the two .gz files you downloaded from http://katlas.math.toronto.edu/backup/ to your document root directory. If you didn't change it above, the default is Apache2/htdocs under the directory you installed the Saint in. (So quite likely c:\Program Files\TSW\Apache2\htdocs\.

Unzip and untar as appropriate. Unfortunately the web backup contains some other stuff you don't need; feel free to delete the Topology0506, webalizer, and phpmyadmin directories.

Warning: you may not have the .htaccess file in the document root - it's not in the web backup from katlas. Recreate it containing the lines:

RewriteEngine on
RewriteBase /
RewriteRule ^wiki/?(.*)$ w/index.php?title=$1 [L]

Import the katlas SQL database

Before we can import the database, we need to create it. If you're comfortable using MySQL, just create a new database called 'wikidb'. Otherwise, use the web interface provided by Saint:

  1. Go to http://localhost:3000/
  2. You'll be prompted for a username and password. These are initially admin and accessrequired.
  3. (optional) Change to English, using the drop down box at the top left of the window.
  4. Select 'PHPMYADMIN' from the toolbox on the left.
  5. In the 'Create new database' box, type 'wikidb' and click 'create'.

Now use the command line mysql interface: from the command line, go to c:\path\to\tsw\DB\MySQL4\bin and run mysql -u root -p. Leave the password blank. Switch the wikidb database with use wikidb, then import the database, with

source c:\path\to\document-root\wikidb-backup.sql

Get some coffee! (It actually doesn't take too long.)

Prepare the mediawiki installation

Things won't just work out of the box. I think it's best to do a mediawiki install, then re-incorporate KnotAtlas specific settings. In the w/ directory of your document root, delete or rename LocalSettings.php and config/LocalSettings.php

Now open a web browser, and go to http://localhost/w/config/

Hopefully this will work okay! Fill in the form, making sure you enter:

wiki name: Knot Atlas (with the space!)

database name: wikidb
database table prefix: mw_

Hopefully everything will work, and you'll see

Success! Move the config/LocalSettings.php file into the parent directory, then follow this link to your wiki.

If so, do exactly that, and go enjoy your handiwork!

You'll need to move a few things across from the original katlas LocalSettings.php (and if this is a permanent mirror, look carefully for other things!), in particular the namespace definitions, navigation links and ifpageexists extension:

$wgExtraNamespaces =
       array(100 => "Data",
             101 => "Data_talk",
             102 => "Article",
             103 => "Article_talk");
# Enable subpages in the knot data namespace
$wgNamespacesWithSubpages[100] = 1;
$wgNamespacesWithSubpages[101] = 1;
$wgNamespacesWithSubpages[102] = 1;
$wgNamespacesWithSubpages[103] = 1;

$wgNavigationLinks = array (
        array( 'text'=>'mainpage',       'href'=>'mainpage' ),
        array( 'text'=>'todo',           'href'=>'todo-url' ),
        array( 'text'=>'rolfsen',        'href'=>'rolfsen-url' ),
        array( 'text'=>'thistlethwaite', 'href'=>'thistlethwaite-url' ),
        array( 'text'=>'links',          'href'=>'links-url' ),
        array( 'text'=>'torus',          'href'=>'torus-url' ),
    array( 'text'=>'manual',         'href'=>'manual-url' ),
    array( 'text'=>'whatsnew',       'href'=>'whatsnew-url' ),
        array( 'text'=>'recentchanges',  'href'=>'recentchanges-url' ),
        array( 'text'=>'randompage',     'href'=>'randompage-url' ),
        array( 'text'=>'help',           'href'=>'helppage' ),
);

include("extensions/IfPageExists.php");

Setting up texvc

katlas uses the <math> tags frequently, so you'll need to get texvc working. First try this precompiled binary. Put it in /w/math/. Then edit /w/includes/Math.php, replacing the line

wfDebug( "TeX: ".$cmd ); 

with

$cmd=str_replace("'", "\"", $cmd);
wfDebug( "TeX: ".$cmd );

You'll also need to comment out:

// need to comment this out to work on windows.
/* if( !is_executable( $wgTexvc ) ) {
    return $this->_error( 'math_notexvc' );
} */

Then edit LocalSettings.php to enable texvc.