Howto install MediaWiki software on Ubuntu Server

Howto install MediaWiki software on Ubuntu Server

This tutorial describes the installation process of MediaWiki on Ubuntu server. We assume you have already MySQL and Apache installed.

First we start installing the mediawiki software:

$ sudo apt-get install mediawiki

Add the following to your /etc/apache2/sites-enabled/000-default file.

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName wiki.yourdomain.com
    DocumentRoot /var/lib/mediawiki

    <Directory /var/lib/mediawiki/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all

        #authentication scheme
        AuthType Basic
        AuthName "CompanyWiki"
        AuthUserFile /yourhtaccesspath/.htpasswd
        Require valid-user

    </Directory>

    # some directories must be protected
    <Directory /var/lib/mediawiki/config>
        Options -FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/lib/mediawiki/upload>
        Options -FollowSymLinks
        AllowOverride None
    </Directory>

</VirtualHost>

Since our wiki is for employees only, we protected the wiki with a .htaccess file. Therefore I have added these lines:

        #authentication scheme
        AuthType Basic
        AuthName "CompanyWiki"
        AuthUserFile /yourhtaccesspath/.htpasswd
        Require valid-user

If you want to create a public wiki, you should remove these lines.

Restart Apache in order to load the new configuration:

$ sudo /etc/init.d/apache2 restart

Now it is time to setup our MySQL database. Login to MySQL:

$ mysql -uroot -p

Create the mediawiki database

create database mediawiki;

Create a wiki user (if needed).

create user 'wikiuser'@'localhost' identified by 'yourpassword';

Grant privileges to the wikiuser

grant select, insert, update, delete, create, 
     index on mediawiki.* to 'wikiuser'@'localhost';

You can now visit your wiki and follow the instruction at: http://wiki.yourdomain.com

If everything worked out well you should see a message like the screenshow below. Congratulations you have successfully installed your MediaWiki!

MediaWiki installed successfully

Leave a Reply

Your email address will not be published. Required fields are marked *