Never Ending Security

It starts all here

Create Your Own Wiki Site with MediaWiki on Linux


MediaWiki is a PHP wiki package, originally intended for use on WikiPedia, which allows anyone to create their own personal wiki site. It is used by a majority of the wikis on the Internet. More information about MediaWiki can be found on its homepage.

Setting Up Your Server

After you have installed the LAMP stack, we will first need to install a few additional PHP 5 modules. All four are optional, but the first two in particular (Intl and GD) are recommended.

The first one we will be installing is the Intl extension, for internationalization support:

sudo apt-get install php5-intl

Secondly, we will install GD for image thumbnailing:

sudo apt-get install php5-gd

You can install Tex Live for in-line display of mathematical formulae.

sudo apt-get install texlive

Finally, you can install XCache for added performance.

sudo apt-get install php5-xcache

After you’ve installed the modules you want, restart Apache.

sudo service apache2 restart

Downloading MediaWiki

Create Your Own WikiIn this section we will download MediaWiki.

MediaWiki is available on the apt-get repository of Ubuntu, but it is out of date. Therefore, it is best to download MediaWiki from source.

curl -O

You can double check the latest version on this page. Copy the link fromDownload MediaWiki followed by a version number and use that instead of the link above.

After it has finished downloading, extract the package:

tar xvzf mediawiki-*.tar.gz

Next, we will move the MediaWiki directory to the document root:

sudo mv mediawiki-1.24.1/* /var/www/html

Creating a Database

In this section we will set up a MySQL database. This is not strictly required to successfully install MediaWiki, as you can use a SQLite database as well. Despite this, it is definitely a recommended measure.

To create the database, we will first log in to MySQL:

mysql -u root -p

You will see your terminal prompt change to mysql>.

We can now create the database. You can choose whatever database name you prefer, but the default name in MediaWiki’s configuration is my_wiki.


You should see the output:

Query OK, 1 row affected (0.00 sec)

Next, we will create a database user for the MediaWiki installation:


Change the first highlighted variable to your chosen database name, the second variable to the username you want to use, and the last to a secure password. You should see the output:

Query OK, 0 rows affected (0.00 sec)

Next, we need to flush the MySQL privileges.


The output should be:

Query OK, 0 rows affected (0.00 sec)

Last, we will need to exit the MySQL shell:


The output should be:


Setting Up MediaWiki

In this section, we will set up MediaWiki so it is ready to use. Visit the homepage of your Droplet in your browser by pointing your browser to http://your_server_ip. On this page, select set up the wiki.

On the first page, select a language and click Continue. The next page should show your environment and it should say in green: “The environment has been checked. You can install MediaWiki.” Click Continue.

You will now get to the page with MySQL settings. For the Database type select MySQL (or compatible). For the database host, use localhost, and for the database name, username, and password, use the values you chose before. The table prefix can be left empty. It will look like this:


After you have completed this step, you will need to complete the tutorial. In the screen after the MySQL settings, the values can be left at their defaults. In the next screen, you will need to fill in the details of your wiki, like its name. You can also create the admin user for the wiki on this page.

In all the other screens, most, if not all, of the settings can be left untouched. If you want a specific setting enabled for your wiki, you might need to change something on one of these screens. Particularly if you have installed XCache before, you will need to check that to enable it.

When you have completed these steps, you should arrive at this page:


A file called LocalSettings.php should start downloading automatically. To successfully complete the installation, you need to move this file to the server, so make sure to download the file before closing the page.

You should now move it the file to /var/www/html on the server. The easiest way to do this is to open the file on your own computer, copy the contents and paste them into the server. To do this, first open the file on the server:

nano /var/www/html/LocalSettings.php

Now, open the file on your computer in your text editor of choice and copy the contents into your SSH window. After you have saved the file, you can click enter your wiki and your wiki should be ready to use.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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 )

Google+ photo

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

Connecting to %s