Notes on Mediawiki/Ubuntu server install

12 03 2011

Just so that I remember what I did…Upgraded Ubuntu 8 to 10.4 LTS using some instructions from the web – worked over SSH no problem.

Installed Apache2, MySQL and PHP using:

sudo apt-get install apache2 mysql-server php5 php5-mysql

At this point, browsing to the IP address of the server gives me the default Apache page.

Downloaded the Mediawiki tarball from  (had to use wget since my server doesn’t have X running).

Used gunzip to unzip the file, and then tar-xvf mediawiki* to extract it from the TAR.

Moved it to /var/www using ‘mv ~/mediawiki-1.16.2 .’  (Has to be done as root or using sudo)

Renamed it using ‘mv /var/www/mediawiki-1.16.2 /var/www/wiki’ since this is going to be in the URL of the site.

We’re using the ‘in-place’ web install here.  Did a ‘sudo chmod a+w /var/www/wiki/config’ to make the config directory world-writable (not sure if this is advisable, but it is what the INSTALL file says to do – will review later).

Edited the httpd.conf file to give the server a name: ‘sudo vim /etc/apache2/httpd.conf’ and entered ‘ServerName cerberus’ into the file.

Apache is running, but when I browse to http://<ip-address>/wiki, it is prompting me to download the PHP file for the setup, rather than running it.  This is presumably because Apache doesn’t yet understand PHP files.  Turns out, there’s no file anywhere on the system, so I guess I can’t add it to the httpd.conf file so Apache knows what to do.

Created a file called testphp.php in /var/www with just <?php phpinfo(); ?> in it, and browsed to that, and it works.  So maybe I am wrong and PHP is ok.

Did a sudo apt-get install libapache2-mod-auth-mysql based on this website:

No difference.

Added ‘’ into /etc/php5/apache2/php.ini

No difference.

Duh.  After some fooling around, it turns out that I need to browse to http://<ip-address>/wiki/index.php even though I have the line ‘DirectoryIndex index.html index.php’ in my /etc/apache2/httpd.conf file.

Click the “set up wiki” button.

Give it a name, create an admin user called andrew with a password.

Left most things as default, but specified a password for the wikiuser of the wikidb SQL database.  Clicked create, but it failed because wikiuser or his password is not correct.

At the command-line, entered ‘mysql -u root -p’ and then the root password.

Then did:

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

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

Query OK, 0 rows affected (0.00 sec)

mysql> \q

And it works.  Thank god for that.

Moved /var/www/wiki/config/LocalSettings.php to its parent directory.  Then did a ‘chmod 664 /var/www/wiki/LocalSettings.php’ to give it less than world writeable permissions.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: