MediaWiki Installation and Internal IT Documentation

MediaWiki thumbnailOne of the most important tasks for a system adminstrator is to keep detailed and up-to-date documentation for all the equipment, procedures, and software in use at a site. This is not only useful for co-system-administrators and future system administrators, but also for yourself because eventually, you will forget about a lot of things that you don't have to deal with on a daily basis.

A wiki is usually a web-based software that allows for users to easily create and maintain a lot of information. A good example of a wiki is the site, Wikipedia. Wikipedia runs on the free and open source software called MediaWiki. In fact, Mediawiki was created especially for Wikipedia and was then later released as free and open source software. We'll install MediaWiki for ourselves becase it is well supported, popular, reliable, and popular. It has been proven to be secure and reliable, and chances are that a lot of system adminstrators are already familiar with the wiki markup that is used by MediaWiki.

Installation

1. Make sure that you have a webserver, PHP5, MySQL5 running on your server. If you don't, then you can look at the following tutorial on easy instructions for installing all that a Debian/Ubuntu server: Installing Apache 2.2, PHP5, MySQL5.

2. Download MediaWiki 1.15.x from http://www.mediawiki.org/wiki/Download

$ cd /usr/local/src/

$ sudo wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz

$ sudo tar -xvzf mediawiki-1.15.1.tar.gz

$ sudo rm mediawiki-1.15.1.tar.gz

3. Move the mediawiki directory to your web serving folder, which is often /var/www/ and rename it wiki

$ sudo mv mediawiki-1.15.1/ /var/www/

$ sudo mv /var/www/mediawiki-1.15.1 /var/www/wiki

Now the wiki will be accessible through http://Server.IP.Address/wiki

4. Create a database, and a database user and a password for this. You can use either phpmyadmin or the command line interface for MySQL.

Using the command line log in to the MySQL admin console (It will ask you for your mysql root password after the following command):

$ mysql --user="root" --password

Give it the command to create a user. The following creates a user called wikidbuser with the password 'your-password':

mysql > CREATE USER 'wikidbuser'@'localhost' IDENTIFIED BY 'your-password';

Now create a database for the wikie:

mysql > CREATE DATABASE wikidb;

Finally, grant the mysql user you created privileges to use the database you created:

mysql > GRANT ALL ON wikidb.* TO wikidbuser@'localhost';

mysql > quit

If you have phpmyadmin installed on your server, you could have done the above by going to http://Server.IP.Address/phpmyadmin (Note! If you've granted the privileges using the command line then you don't need to do the same again using phpmyadmin!):

Create a database from the front page:

Create Database

On the main page, click on privilege:

phpmyadmin priv

Then scroll down to "Add a new User":

Add a new user

Fill the form; Host should be localhost in our case:

Fill the form

After the form is submitted, you'll get to a new page that gives you confirmation that the database has been created. Scroll down to Database-specific privileges:

Database specific privileges

Click on the drop down menu that says 'User Text Field' and choose the database that you created earlier. The page will change and you'll get a chance to indicate what privileges the users should have. Click on Go.

database privileges

I prefer the command line interface for this because it's much quicker.

5. Next we will temporarily make the config subdirectory writable by the server. This is so that mediawiki can configure everything using the installation script.

$ sudo chmod a+w /var/www/wiki/config

6. Go to http://Server.IP.Address/wiki/config/index.php and fill out the form. Make sure that Checking Environment does not contain any errors. It should say "Environment Checked. You can install MediaWiki." Most of the form fields are self explanatory. Be sure to enter the information in the Database Config correctly. It should be the database name, database user, and password that we created in Step 4. MySQL Specific options can usually be ignored unless you are doing something that is not common. Click the Install MediaWiki button. If everything went correctly, you will see the following:

MediaWiki Installed

7. Finally, move the config/LocalSettings.php file to the parent directory and then change the permissions to 700

$ sudo mv /var/www/wiki/config/LocalSettings.php /var/www/wiki

$ sudo chmod 700 /var/www/wiki/LocalSettings.php

$ sudo rm -r /var/www/wiki/config

The database user only needs to have SELECT, INSERT, UPDATE and DELETE permissions for the database. So you can go back and revoke all the extra database permissions for the wiki db user for security purposes.

8. Finally, go to http://Server.IP.Address/wiki and you will have access to your new Documentation Wiki.

MediaWiki Installed

Internal IT Documentation

If you are going to use this wiki for documenting Internal IT related entities and procedures, you will want to make this wiki private. Create a new account for yourself (and your fellow system administrators) and then disable registration, and anonymous access to your wiki. This will ensure that only your IT staff will have read and write access.

In order to disable new account registrations for users edit the LocalSettings.php file in your wiki folder and look for a line that starts with wgGroupPermissions. If you find one or if it doesn't exist, then edit (or add) the line so it says:

$wgGroupPermissions['*']['createaccount'] = false;

This will stop new users from registering. If you want to make all the pages password protected, disable anonymous editting, and allow the main page, login and help pages to be visible, then add the following lines to your LocalSettings.php:

$wgGroupPermissions['*']['read'] = false;

$wgGroupPermissions['*']['edit'] = false;

$wgWhitelistRead = array ( “Main Page”, “Special:Userlogin”, “Help:Contents");

This will password protect all pages except your MainPage, UserLogin page, and Help:Contents page. Users who signed up before removing group permissions will be able to log in but no one else will be able to sign up for or browse the wiki.

Use this wiki to document your internal IT Procedures, network diagrams, information about hardware/software, contact information for important people and vendors. You probably won't have to document each and every IT procedure and entitiy but be sure to write down stuff that you won't be accessing regularly (like installation procedures, data recovery procedures, etc.)

You should probably install another wiki at a different URL for your customers and document things for them such as password recovery options, contact information, and other frequently asked questions.

You may also want to add some mediawiki extensions that allow you to format any code that you document.

If you want more help with using the wiki, the following link has all the common commands for editing mediawiki pages: MediaWiki Cheat Sheet



Comments

Thanks,

Thanks, this was helpful!

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options