Install MediaWiki on the One-Click LEMP Application

Published on: Wed, Mar 4, 2015 at 11:13 am EST


MediaWiki is a popular open-source wiki software package. In this article, we will show you how to install MediaWiki on a Vultr server based on the One-Click LEMP application.


We assume that you have deployed a One-Click LEMP Vultr server instance from scratch and have logged in as root. Non-root users will need to use the sudo command.

Step one: Create a database

By default, the MySQL root password is saved on the VPS in /root/.my.cnf. Make it display on the screen with the following command:

cat /root/.my.cnf

Use the credential displayed on the screen to log into MySQL:

mysql -u root -p

Create and configure a database in MySQL with the following commands. Remember to replace the database name mywiki, the user name myusername, and the password mypassword with your own ones.

create database mywiki;
create user 'myusername'@'localhost' identified by 'mypassword';
grant all privileges on *.* to 'myusername'@'localhost' identified by 'mypassword' with grant option;
flush privileges;

Step two: Download the MediaWiki package

At the time of writing, the latest version of MediaWiki was 1.24.1. Download and unzip the latest MediaWiki package to a user-friendly directory with the following commands:

cd /usr/share/nginx/html
tar xvzf mediawiki-1.24.1.tar.gz
mv mediawiki-1.24.1 wiki

Step three: Configure and install MediaWiki from your browser

Note: Before the installation, you need to modify the default access permissions to the directory /var/lib/php/session to 777, or you will encounter a permission error.

chmod 777 /var/lib/php/session

Visit http://[SERVER_IP]/wiki/ in your browser. Substitute the [SERVER_IP] with the IP address of your VPS.

Click the link "set up the wiki" to initialize the installation wizard. Follow the on-screen instructions to configure your MediaWiki.

On the step of "Connect to database", you need to input database parameters as specified below.

Remember to replace the database name mywiki, the table prefix wk-, the user name myusername, and the password mypassword with your own ones.

Database type: MySQL (or compatible)
Database host: localhost
Database name: mywiki
Database table prefix: wk-
Database username: myusername
Database password: mypassword

On the step of "Name", you need to specify the name of your wiki and the administrator's username, password and email address.

All other options can use the default values or be configured later. You can find more details from the MediaWiki official website.

On the final step of "Complete!", a file named LocalSettings.php will be downloaded to your desktop automatically. If the automatic download went wrong, you can download this file manually by click the link "Download LocalSettings.php".

Then you need to upload this file to the base of your MediaWiki installation (the same directory as index.php, e.g., /usr/share/nginx/html/wiki). You can use PuTTY or another SSH client to get it done.

That's it. You have installed MediaWiki onto your Vultr VPS.