IntroductionMediaWiki is free and open-source wiki software and it is the same software used by Wikipedia. It is fully dynamic and runs on a LAMP stack, taking advantage of the
PHP language and the MySQL database backend. With easy installation and configuration, MediaWiki is a good solution when you need a familiar,
full-featured dynamic wiki engine.
RequirementsThe only requirements are to have a user with
sudo privileges (root is fine) and
Apache, PHP, and
MySQL installed on your VPS.
Tutorial on how to create a new user and grant him
sudo privileges can be found
here.
In this tutorial we will be using Ubuntu 16.04, however, you should be able to use all our offered Ubuntu and Debian versions.
In Time4VPS you are able to install Ubuntu 16.04 template really easy and fast, only with few mouse clicks:
- Login to the Client Area;
- Select at the top of menu the "My Services > VPS" tab;
- Press the "Manage" button at the service table;
- Press the "Install OS" button;
- Choose Ubuntu 16.04 operating system, agree with warning and press "Continue";
- Wait for 5-10 minutes and refresh VPS management page.
Updating System
First things first. Like always, first of all, we recommend to update and upgrade your server.
apt-get update
apt-get upgrade -y
LAMP installation:
For starters, you will need to install Apache, PHP and MySQL (LAMP) stack. This can be done with the help of tasksel tool:
sudo apt install tasksel
sudo tasksel install lamp-server
InstallingTo begin, download the latest MediaWiki package. You can find the download location for the releases by visiting the MediaWiki homepage.
Go to web-accessible DocumentRoot, in our case it is:
cd /var/www/html/
Use wget
to download the latest package:
wget https://releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.2.tar.gz
Decompress the package by using the tar
command, as shown below:
tar -xvzf mediawiki-1.30.2.tar.gz
Move the uncompressed mediawiki-1.30.2
directory into your html/
folder, renaming the directory to mediawiki/
in the process.
mv mediawiki-1.30.2 mediawiki
The name of the directory beneath the html/ will determine the path to your wiki. In this case, the wiki would be located at mediawiki/.
The config/ directory inside the mediawiki/ directory needs to allow MediaWiki to write to it during the installation process. Change into the mediawiki/ directory and run the following chmod command:
cd mediawiki
chmod a+w mw-config
mbstring extension needed for MediaWiki is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with commands:
apt-get install php-mbstring php-xml -y
service apache2 restart
ConfiguringOn your browser go to your_domain/mediawiki and click the “Please set up the wiki first” link. The setup page contains everything you need to complete the installation.
Now proceed with the configuration, enter such information as database name, username, and password, and so on.
After completing the installation form and submitting it, you will arrive at the “MediaWiki Installation” page. An automatic file download should be initiated. Save or open the file. Now, get back to SSH access on your VPS. Create a LocalSettings.php file:
nano /var/www/html/mediawiki/LocalSettings.php
Upload the contents of the previously saved or opened file to the LocalSettings.php file and save it.
Since the LocalSettings.php file will contain your MySQL password, make sure to restrict access to it:
chown root:www-data /var/www/html/mediawiki/LocalSettings.php
chmod 640 /var/www/html/media/wiki/LocalSettings.php
Conclusion
MediaWiki is now successfully installed and configured! Now you have powerful and at same time easy to use wiki engine.