Sunday, June 11, 2006

Host your own wikipedia

A quick newbies wikimedia (the wiki engine behing wikipedia) setup for Mandrakelinux release 10.2 (Limited Edition 2005)
(should work on newer release thought).

I suppose apache has userdir enabled. Just download the tarball from the mediawiki sourceforge page, and decompress it into your ~/public_html/
cd ~/public_html
gunzip < media-version.tgz | tar xf -
mv big-wiki-name wiki
chmod a+w config

Then, point your browser to the install url (classical php install).
http://yourhostname/~bsergean/wiki/config/index.php

Then, we have to install some packages ... thanks to the error message that are shown (look how to use urpmf to get package name depending on some file path).

[bsergean@flanders wiki]$ urpmf mysql.so | grep php
php-mysql:/usr/lib/php/extensions/mysql.so
php5-mysql:/usr/lib/php5/extensions/mysql.so
[bsergean@flanders wiki]$ su
[root@flanders wiki]# urpmi php-mysql

ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/main/php-mysql-4.3.10-7mdk.i586.rpm
installing php-mysql-4.3.10-7mdk.i586.rpm from /var/cache/urpmi/rpms
Preparing... #############################################
1/1: php-mysql #############################################
[root@flanders wiki]# exit
[bsergean@flanders wiki]$ su
[root@flanders wiki]# urpmi php-xml

ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/main/php-xml-4.3.10-5mdk.i586.rpm
installing php-xml-4.3.10-5mdk.i586.rpm from /var/cache/urpmi/rpms
Preparing... #############################################
1/1: php-xml #############################################

Now you have to restart the web server, so that the updated php actually is loaded.

[root@flanders wiki]# service -f httpd
Shutting down httpd2: [ OK ]
Starting httpd2: [ OK ]
[root@flanders wiki]#

OK, now we are ready to configure mediawiki. The next big thing is to configure the database (mysql) actually: This is the official page for version 5.
http://dev.mysql.com/doc/refman/5.0/en/index.html

On our config, the database is locally hosted.

Adding user is documented here:
http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

[bsergean@flanders wiki]$ mysql --user=root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'wikiuser'@'localhost'
-> IDENTIFIED BY 'replace_here_with_your_password' WITH GRANT OPTION;
Query OK, 0 rows affected (0.02 sec)

Then, create the db:

So the basic Mandrake install doesn't set the default root password.

[bsergean@flanders wiki]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('replace_by_new_root_password');
Query OK, 0 rows affected (0.02 sec)

mysql> Bye

[bsergean@flanders wiki]$ mysqladmin -u root -p shutdown
Enter password:
[bsergean@flanders wiki]$
[bsergean@flanders wiki]$
[bsergean@flanders wiki]$
[bsergean@flanders wiki]$ ps -ef | grep mysq
bsergean 28191 17261 0 20:11 pts/2 00:00:00 grep mysq

We restart the server as root:

[bsergean@flanders wiki]$ su
[root@flanders wiki]# service mysqld start
Starting MySQL: [ OK ]

Now we login as wikiuser :

[bsergean@flanders wiki]$ mysql -u wikiuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE wikidb;
Query OK, 1 row affected (0.01 sec)

mysql> Bye

Looks like it's done now !!

I have left all the other param to the default value but those ones:

wiki name, admin email ... the easy ones :)
Wiki admin: replaced by root (the regular admin name, no ?)

Then, to speed up thing (if you expect lots of users), we'll urpmi memcached ... whose default port from the man page is 11211
So in the associated box, we'll enter : localhost:11211

We have to start the service, and edit /etc/init.d/memcached, to add the -u mysql to the daemon line. Otherwise you'll get this message :

Starting memcached: can't run as root without the -u switch
[FAILED]
But after the modif ... ->
[root@flanders init.d]# service memcached start
Starting memcached: [ OK ]

Now we click on the Install button ...
And looks like it worked !!

To finish, we just have to move the config/LocalSettings.php file into the parent director

[bsergean@flanders wiki]$ mv config/LocalSettings.php .
# This one just to be sure ...
[bsergean@flanders wiki]$ chmod 755 config

Then, go to http://yourhostname/~bsergean/wiki ...
You're done !!
Now another story begins ;)

0 Comments:

Post a Comment

<< Home