MediaWiki is a free open source wiki program that allows users to create their own personal wiki sites. Originally built for Wikpedia, MediaWiki is written in PHP and uses a backend database, like MySQL, to store its data.
The steps in this tutorial require the user to have root privileges.
Before working with MediaWiki, you need to have LAMP installed on your server. If you don’t have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up http://mohammedwaseem.in/install-lamp-ubuntu/ .
Once you have the user and required software on the virtual private server, you can start installing MediaWiki!
Install Media Wiki
Because the apt-get package of MediaWiki is very out of date, MediaWiki should be installed from source. We can start off by downloading the latest version:
curl -O http://releases.wikimedia.org/mediawiki//1.19/mediawiki-1.19.9.tar.gz After downloading tar, untar it. tar -xvzf mediawiki-1.19.9.tar.gz Move the contents of the MediaWiki directory to a a more convenient location:
sudo mv mediawiki-1.19.9 /etc/mediawiki
Create a symbolic link between the MediaWiki directory and Apache’s document root:
sudo ln -s /etc/mediawiki/ /var/www
And finish up by restarting apache.
sudo service apache2 restart
Create a MySQL User and Database
Although this step is not required for a successful installation of MediaWiki, it is definitely a recommended measure for added security.
During the installation process, you will be asked to supply either a database and associated user for a MediaWiki database or your MySQL root password. MediaWiki uses this information to create the required wiki database and tables.
Setting up a dedicated database can be done very quickly and removes the need for sharing the MySQL root information and the associated security risks. We can go ahead and set up the database now:
Log into MySQL on your server:
mysql -u root -p
Once you are logged in, create your MediaWiki database. The default name that MediaWiki has in their configuration form is my_wiki, but you can name it whatever you prefer:
create database my_wiki;
Additionally, you will need to provide a user for the new database with the permissions that MediaWiki requires (replace the username and password below with details of your choice):
grant index, create, select, insert, update, delete, alter, lock tables on my_wiki.* to 'wikiuser'@'localhost' identified by 'password';
Finish up by implementing the changes and quitting MySQL:
FLUSH PRIVILEGES; exit;
The next part of the installation needs to be completed through the onscreen instructions located at [domain]/mediawiki/index.php
Set Up MediaWiki
Go through and fill out the Media Wiki Site configuration in the browser.
When you reach the “MySQL settings” section of the setup page, leave the Database Host as localhost and then enter in the MySQL database name and username and password, if you configured them in the previous step.
If you did not set up a new user for MediaWiki, write in root for the username and the root password in the password field.
You can leave the “MySQL specific options” section as is.
Once you have finished walking through the the configuration, keep pressing continue until you reach the page that says, “Complete!”
The LocalSettings.php file should start downloading automatically. Make sure that you have downloaded the file before closing out of the page. LocalSettings.php is auto-generated—if you do not have the Local Settings file, you will have to generate it once again by going through all of the MediaWiki setup steps.
Once the file downloads, you should upload it to /etc/mediawiki, or whichever directory contains MediaWiki’s “index.php” file on your virtual server.
You can copy the LocalSettings.php file from your computer to the server, with SCP (Secure Copy), an SSH-based way of transferring files:
cp /path/to/LocalSettings.php /etc/mediawiki
After the file is uploaded, you will be able to access your personal wiki at[domain]/mediawiki.