Help:Setting up this wiki
From BiodivBorneo09
Contents |
Setting up a new Axioo pico as a Wiki server
- Install Fedora 10 (I used Omega remix)
- Get the system updated
# yum groupupdate Base * yum install kernel
- Switch off SELinux
- Get needed software
# yum install ImageMagick php mysql mysql-server php-mysql
- Reboot
- Activate httpd and mysqld from the Services admin tool
- Reboot (seems to be needed to get MySql to start
- Edit httpd.conf, changing the following in the appropriate places:
... DocumentRoot "/var/www/html/wiki/" ... <Directory "/var/www/html/wiki"> ... Options Indexes FollowSymLinks ExecCGI ...
- Set up MySql database
# mysqladmin create bb09 # mysql bb09 ... mysql> create user 'bb09'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> grant all on bb09.* to 'bb09'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> set password for 'bb09'@'localhost' = password('########'); Query OK, 0 rows affected (0.00 sec) mysql> \q
- Unzip the new mediawiki distrib
# cd /var/www/html # tar xvzf mediawiki-1.14.0.tar.gz # mv mediawiki-1.14.0 wiki
- Set permissions (maybe needed by by suexec)
# chown -R apache wiki # chgrp -R apache wiki # chmod -R go-w wiki
- Point your browser at http://localhost, and proceed with the install as directed
- Copy LocalSettings.php from config/ up one directory
- Edit a few things in LocalSettings.php
$wgEnableUploads = true; $wgLogo = "/images/c/c1/BOB2009logo.png" ; $wgGroupPermissions['*']['edit'] = false; $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'txt' );
- Finally, set the max file upload size in
/etc/php.ini
:
; Maximum allowed size for uploaded files. upload_max_filesize = 500K
Backing up the wiki
It seems the three parts of backing up are:
- Backing up the physical PHP and image directories:
# tar cvzf 2009-06-01_wiki.tgz wiki ... or ... # rsync -avP --delete wiki/ cwebb@phylodiversity.net:backup/bb09wiki/
- Backing up the mySQL database:
# mysqldump bb09 > ~/backup/2009-06-01_bb09.sql
- Backing up the Wiki via its XML form
# php maintenance/dumpBackup.php --current > ~/backup/2009-06-01_bb09.xml
In fact, here's a script (backup.sh) to help. Place in /var/www/html:
#!/bin/sh DATE=`date "+%F"` php wiki/maintenance/dumpBackup.php --full > wiki/backup/$DATE.xml mysqldump bb09 > wiki/backup/$DATE.sql rsync -avzP --delete wiki/ bb09@phylodiversity.net:WEBSITE/wiki/
A live wiki should be made readonly while backing up with:
$wgReadOnly = 'Temporarily locked: backing up';
Restoring (mirroring) to Dreamhost
- Make sure the newest version is rsync'd into place
- Create a new empty mysql DB with the control panel. If existing, drop all tables (thanks for this post):
# mysql -h mysql.phylodiversity.net -ucwebb -pfoo testdb -e "show tables" | \ grep -v Tables_in | grep -v "+" | \ gawk '{print "drop table " $1 ";"}' | \ mysql -h mysql.phylodiversity.net -ucwebb -pfoo testdb
- Log into bb09@phylodiversity.net and cd to the wiki directory
- Load the data:
mysql -h mysql.phylodiversity.net -u foo -pfoo wikidb < backup/2009-06-01.sql
- For dreamhost, make sure php5 is being used by adding a .htaccess file:
Options +ExecCGI AddHandler php5-cgi .php
- Edit the LocalSettings.php (from diff output):
> $wgScriptPath = "/bb09/wiki"; ... > $wgDBserver = "mysql.phylodiversity.net"; > $wgDBname = "testdb"; > $wgDBuser = "foo"; > $wgDBpassword = "foo"; ... > $wgLogo = "/bb09/wiki/images/c/c1/BOB2009logo.png" ;
Make sure the images directory is writable:
$ find images -type d -execdir chmod g+w '{}' \;
Note: PdfExport does not work because of lack of htmldoc (also set temp dir on L40 of extensions/PdfExport/PdfExport_body.php. Also may need to fiddle to get Math working, due to lack of installed ocaml, etc. Set
$wgUseTeX = false ;
Best to leave the public mirror readonly:
$wgReadOnly = 'This is a mirror';
PDF Export
A nice extension; another, untried tool is wikipdf.
- Install htmldoc with yum
- Create a directory called PdfExport in extensions
- Copy files from here to the four files indicated
- Make a new tmp directory:
# mkdir /var/www/tmp # chown apache /var/www/tmp
- Edit lines in PdfExport_body.php. Edit:
$mytemp = "/var/www/tmp" . "/f" .time(). "-" .rand() . ".html";
and replace:
$bhtml = str_replace ($wgScriptPath, $wgServer . $wgScriptPath, $bhtml);
with:
$bhtml = str_replace ("href=\"/index.php", "href=\"" . $wgServer . "/index.php", $bhtml); $bhtml = str_replace ("src=\"/images", "src=\"" . $wgServer . "/images", $bhtml);
(Thanks to comments on the discussion page for Pdf_Export)
- Add to LocalSettings.php
require_once("extensions/PdfExport/PdfExport.php");
Semantic MediaWiki
(See excellent directions here)
- Untar the latest release of this important extension into extensions
- Add these lines to LocalSettings.php:
include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php"); enableSemantics('phylodiversity.net');
- Log in as admin and go to Special:SMWAdmin
- Click `build tables,' then `repair data' (wait a long time), and all should be functioning.
Maths
(See here for details)
- Install some extras, and build:
# yum install yum install ocaml gv dvipng dvips texlive texlive-latex # cd math # make
- Edit LocalSettings.php
$wgUseTeX = true ;
- Include LaTeX maths expressions. <math>\int\limits_a^x f(\frac{\alpha}{2}\,)\,dx</math> is created by:
<math>\int\limits_a^x f(\frac{\alpha}{2}\,)\,dx</math>
See this guide to LaTeX maths markup.
File sharing
SAMBA
# yum install samba system-config-samba samba-swat
- Start smb and swat with Services. A reboot may be needed. Be sure to allow samba through the firewall (Admin -> Firewall).
- Create special users for files. It seems to easy to expose the entire home directory for a subdirectory.
# system-config-samba &
- Set up a samba user for existing users. A working
/etc/samba/smbusers
is:
root = administrator admin nobody = guest pcguest smbguest files = files share = share
- Add samba shares. A working
/etc/samba/smb.conf
is:
[global] workgroup = bb09files server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 security = user passdb backend = tdbsam cups options = raw username map = /etc/samba/smbusers guest ok = yes [homes] comment = Home Directories browseable = no writable = yes [printers] comment = All Printers path = /var/spool/samba browseable = no printable = yes [BB09FILESW] comment = BB09 resources writable path = /home/files writeable = yes valid users = files [BB09FILES] comment = BB09 resources path = /home/files valid users = share [BB09SHARE] comment = Filesharing area path = /home/share writeable = yes valid users = share
- Alternatively, use swat by browsing to
http://localhost:901/
. - Now, access possible with smb://192.168.1.100/ or smb://192.168.1.5/bb09files/ for a specific shares.
HTTP access
In httpd.conf
add an alias:
Alias /bb09files/ "/home/files/" <Directory "/home/files"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
Files (or directories) can now be accessed with direct URL links. Use links of the form [http://{{SERVERNAME}}/bb09files/]
so that they work when the wiki is migrated to a different server. I.e., our files top directory.
Other extensions installed
- CategoryTree
- Cite[1]
- DumpHTML. Dump with:
cd /var/www/html/wiki/extensions/DumpHTML php dumpHTML.php -d /var/www/html/static -k monobook --image-snapshot --show-titles find /var/www/html/static -name "Talk~*" -exec rm -v '{}' \; # deletes talk pages cp -a ../../skins /var/www/html/static/. tar chvzf bb09.tgz /var/www/html/static # -h for deref symlinks # rsync -aPL /var/www/html/static/ bb09@phylodiverity.net:static/
CSS tweaks
I didn't like some of the original choices in monobook. Here are my new values (changes only):
h1, h2, h3, h4, h5, h6 { /*border-bottom: 1px solid #aaa; */ /* drop */ } h2 { font-size: 160%; /* bigger */ font-weight: bold; /* bold */ margin-top: 1em; /* more */ } h3 { font-size: 120%; } /* smaller */
To do differently next time
- Make the student home pages be their User:Foo page.
Footnotes
- ↑ The footnote