Installing MediaWiki on a hosting account
According to Wikipedia.org, "MediaWiki is a free web-based wiki software application. Developed by the Wikimedia Foundation and others, it is used to run all of the Foundation's projects, including Wikipedia, Wiktionary and Wikinews. Numerous other wikis around the world also use it to power their websites."
Before anything else, you need to log into your shell account. To do this, you'll need a Secure Shell (SSH) client. You can read more about shell access on your hosting account here. You'll also need FileZilla, or an alternative SCP (Secure copy) client to upload files to your account later on in the article.
Before anything else, you need to log into your hosting account so that you can upload files. To do this, you'll need an FTP client. You can read more about FTP access on your hosting account here.
Installing MediaWiki - Part 1
Once at a shell, your current location will be your home directory. You can use the
ls command to get a list of files and directories in your home directory. Use the command
cd www to change into the web directory. By running
ls again, you'll see a directory that corresponds to the address of your website. Change into the root web directory for your site. For example, if your website was 'example.mythic-beasts.com', then you'd run the command
cd example.mythic-beasts.com. If you want to install MediaWiki in a separate section of your site, For example, 'example.mythic-beasts.com/wiki', then you can do this by creating a directory called wiki, using the command
mkdir wiki and then changing directory into that folder using the command
I'm going to assume that you are using the free FileZilla FTP client for this support article. Once you are logged in to your hosting account with FTP, your current location will be your home directory. Double-click on the
www to change into the web directory. You should now be able to see a directory that corresponds to the address of your website. Double-click on that directory to change into the root web directory for your site. If you want to install MediaWiki in a separate section of your site, For example, 'example.mythic-beasts.com/wiki', then you can do this by creating a directory called wiki, by right-clicking when in the root web directory, and selecting the 'Create directory' option. From here, replace the highlighted 'New directory' text with the name of the directory you want to create. You'd change this to 'wiki' if you wanted your MediaWiki site to be at the aforementioned example link. Following this, you need to double-click on the new directory you just created.
Now that we are in the directory where we want to install MediaWiki, the next step is to download it. You need to go to the MediaWiki download page and copy the 'Download MediaWiki' link for the the latest version. Hopefully, you'll be able to paste the link into your SSH client by right-clicking while in the terminal, or right-clicking and then selecting paste. Otherwise, I'm afraid you'll have to do it manually. Use the command
wget [link you just copied] to do download the file (it should only take a second). Once the file has downloaded, use the command
tar -xzvf mediawiki-x.xx.x.tar.gz, where x is the version number of MediaWiki that you downloaded, to extract the files from the tar.gz archive. If you use the
ls command, you should be able to see that a new directory called 'mediawiki-x.xx.x' has been created. There is now no use for the 'mediawiki-x.xx.x.tar.gz' file, so you can remove it using the command
rm mediawiki-x.xx.x.tar.gz. You need to move the files out of the 'mediawiki-x.xx.x' directory into the directory you are currently in. You can do this using the command
mv mediawiki-x.xx.x/* . (notice the dot character at the end. It is part of the command, not a full stop). You can now also remove the 'mediawiki-x.xx.x' directory with the command
rm -r mediawiki-x.xx.x.
Now that we are in the directory where we want to install MediaWiki, the next step is to download it. You can get it from the MediaWiki download page and copy the 'Download MediaWiki' link for the the latest version. Save the file to somewhere you can work from on your computer, as you'll need to change some of the files before uploading them to your hosting account.
If you are running Windows, then you'll need to download a program such as 7-Zip to extract the tar.gz file. I'll assume that you're using 7-Zip for the sake of this article. Once you have downloaded and installed 7-Zip, you'll need to go to where you downloaded the tar.gz file in Windows Explorer. Once you find it, right click on it, hover your mouse over the '7-Zip' option, and then select 'Extract here'. Notice that another file has been created. This is because a tar.gz file is a tar file inside a gzip file. You now need to repeat the process of extraction for the tar file that you just extracted. You should now see a 'mediawiki-x.xx.x' directory.
If you are using the Safari browser on a Mac, then a tar file will be extracted out of the the tar.gz file automatically once it has been downloaded. If you go to your Downloads folder, and double click on the 'mediawiki-x.xx.x' file, then it will be extracted and then you should be able to see the 'mediawiki-x.xx.x' directory.
This is the directory we'll be working from. There is now no use for the other files we downloaded or extracted, so feel free to delete them.
Uploading MediaWiki to your hosting account
Using the file browser on the left-hand side of the FileZilla FTP client, locate the 'mediawiki-x.xx.x' folder you have been working from. When you find it, double-click on the folder to change into it. Use the key combination Ctrl + a (or CMD + a on a Mac) to select all of the files in the folder. Right-click on the selected files and choose upload. Wait while the files are uploaded to the server.
This section does not apply if you are using a shell hosting account.
Installing MediaWiki - Part 2
You need to open a web browser and go to the site where you just installed MediaWiki. From here, click on the 'set up the wiki' link. Select a language and then click on the continue button. There may be a couple of warnings during the Environmental checks, but you can safely scroll down to the bottom and click the continue button.
MediaWiki needs a database to work. You will have login information for your MySQL database in the email that you received from us after signing up for a hosting package. Ensure that the selected database type is 'MySQL'. You need to fill in the Database hostname, Database name, the Database username, and the Database password (which will be different to the password for your shell account). You only need to fill in the Database table prefix field if you are using the Database for more than one thing. A good prefix would be 'mw_' or similar. Once you have done this, click the continue button. You can happily leave the 'Database settings' page alone and click continue again.
It's now time to fill in the wiki name, and things about you (the administrator), such as your name, a secure password, and an email address. You can leave the project namespace as it is. We suggest that you choose to 'Ask me more questions', rather than 'I'm bored already, just install the wiki'. Once you have done this, click the continue button.
The next page is really up to you to fill in, all of the possible options are explained on the page by clicking on the little help links, so make sure you pick the options that best suit how you would like your wiki to work. You'll want the site email address to be something in the sites domain, such as 'email@example.com'. You can leave the options in the 'Extensions' section unticked and make sure that you keep the object caching setting to 'No caching'. Once you have filled in this page, click 'Continue'. Click continue again to begin the installation of MediaWiki. Once the installation has finished, click continue.
You should now be at the 'Complete' page. The configuration wizard you have just worked through has generated a 'LocalSettings.php' file, which is a configuration file that will need uploading to the MediaWiki directory on your web server. Save this file to somewhere on your computer.
Uploading LocalSettings.php to your hosting account
Using the file browser on the left-hand side of the FileZilla FTP client, locate the 'LocalSettings.php' file that you have just downloaded. Make sure that you have changed into the folder for the site where you have installed MediaWiki in the file browser on the right-hand size of FileZilla. Right-click on the 'LocalSettings.php' file and choose upload. Wait while the files are uploaded to the server.
I'm going to assume that you are using the free FileZilla SCP client to access your shell account. When logging in, make sure that you set the port to 22 so that you are logged in with SCP rather than FTP. Once logged in, navigate through the filesystem to find the folder where MediaWiki is installed. Right-click on the 'LocalSettings.php' file and choose upload. Wait while the files are uploaded to the server.
People contributing to your wiki can upload images to your server. Before we continue with the installation of MediaWiki, we need to secure the images directory on the server, so that no malicious code can be executed. To do this, we'll need to create a .htaccess file, which tells Apache (the web server) what is allowed (or in this case not allowed) to happen in the directory that the .htaccess file is in.
You'll need to open up a text editor, such as Notepad, TextEdit and then enter the line
Options -ExecCGI — save this file as htaccess.txt.
You now need to use FileZilla to upload this 'htaccess.txt' file to the images directory inside the directory where you installed MediaWiki. Once you have done this, you need to right-click on the file in the file browser on the right-hand side of FileZilla, and select the 'Rename' option. You need to rename the file from 'htaccess.txt' to
.htaccess (make sure you start it with a dot).
cd command to change directory into the images folder of your MediaWiki site. Once you are there, type the command
echo 'Options -ExecCGI' > .htaccess (make sure you start .htaccess with a dot). This will create a file called .htaccess containing the line 'Options -ExecCGI', which is exactly what we need.
Visiting your wiki
Once you have have uploaded 'LocalSettings.php' to your MediaWiki site, you can either click the 'enter your wiki' link from the 'Complete' page we were on before, or simply go to the address of the site where you installed MediaWiki in your browser to view your wiki. You will arrive at the main page of your site, which will explain that 'MediaWiki has been successfully installed'.
The MediaWiki User Guide is very detailed and should be more than adequate to guide you through the rest of the process of creating your wiki.
Copyright © 2000-2012 Mythic Beasts Ltd. All Rights Reserved.