razzi.abuissa.net

Razzi's guide to MediaWiki

MediaWiki is the wiki software that powers Wikipedia.

You can use it to run your own personal wiki as well. The software is a bit old (from 2001) and it shows in some places, but overall the experience running it is pleasant.

installation

The simplest way is to use apt. You can read the official documentation for this approach at mediawiki.org.

sudo apt install mediawiki

This will install many dependencies, such as apache2, mysql, and php.

Once it finishes, open http://localhost/mediawiki/ in your browser, and you’ll be greeted with a screen like so:

Take the link to the installation page, and proceed by selecting a language.

When you get to the database setup page, you’ll need mysql config like the following (change the database password):

CREATE DATABASE my_wiki;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'database_password';
GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;

taken from https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#MariaDB/MySQL

Then you’ll have to change the database username to “wikiuser” and enter the password you chose into the “Connect to database” installation page.

You can continue through to the Name page, where you’ll enter the final necessary configuration: wiki name and admin username and password.

It’s worth looking at the additional settings though, as it covers important stuff like who can edit your wiki. For example if it’s just for you, you’ll want it to be a private wiki. I made my personal wiki “open edit” style at the start but eventually a trickle of spam in foreign languages made me prevent new user creation and restrict editing to registered users (just me).

When you proceed past the database configuration, it’ll run some sql commands in the background to set up your database schema:

Then when you get to the very end of the installation, it’ll download a LocalSettings.php file:

Copy that file in to /etc/mediawiki/ using a command like so:

sudo cp ~/Downloads/LocalSettings.php /etc/mediawiki/

Then when you go back to http://localhost/mediawiki/ you’ll be greeted with the main page!


(work in progress, I’d like to add the steps to make the urls pretty like http://localhost/wiki/Main_Page rather than the default http://localhost/mediawiki/index.php/Main_Page)