PDA

View Full Version : How to install MediaWiki on WestHost VPS



nsc
01-07-2005, 02:42 PM
Here are instructions for installing MediaWiki on WestHost VPS:

MediaWiki (http://www.mediawiki.org) (MW) is a wiki (http://www.wikinfo.org/wiki.php?title=Wiki) PHP (http://www.php.net) script, useful for maintaining manuals or documentation. It is not the best wiki script, but it is very popular. The instructions below are valid for version 1.3.9. - If you want a better script better look at TikiWiki (http://www.tikiwiki.org) (I will also post instructions for it soon!).

Before installing MediaWiki:

- Check the GPL (http://www.gnu.org/licenses/gpl.html) license.
- Make a backup of your site
- Optional but highly recommended: Turn register_globals off.

HOW TO TURN REGISTER GLOBALS OFF:

To find out what register_globals is, click here (http://www.php.net/manual/en/security.globals.php).

In WestHost's PHP 4.3.0 the register_globals is ON, but MediaWiki does not need it to be on. Actually it is recommended to make sure register_globals is OFF because of potential security issues.

The problem is that turning register_globals off will make some other PHP scripts to work incorrectly or not work at all! I have tested it and it broke phpMyAdmin. Fortunately, it is easy to fix it: Just turn register_globals again on or update phpMyAdmin to the last version. MW can work with any setting.

To turn register_globals off, connect with SSH to your VPS. To learn about SSH, click here (http://members.westhost.com/ssh-manual.html).

Once in SSH, issue the command



pico /usr/local/lib/php.ini


Go to line 316, which is:



; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = On


Change the register_globals line to:



register_globals = Off


Save the file by pressing CTRL+O, ENTER. Now exit by pressing CTRL+X.

HOW TO INSTALL MEDIAWIKI:

In the SSH environment, issue this command to go to your website files:




cd ~/www



and now type this to download MW:




wget http://location.of.mediawiki.download.file



like this:




wget http://voxel.dl.sourceforge.net/sourceforge/wikipedia/mediawiki-1.3.9.tar.gz



Now type this to uncompress the file:




tar -zxvf mediawiki-1.3.9.tar.gz



Now you have a tar.gz file and a mediawiki-1.3.9 directory.

Issue this to rename the directory:




mv mediawiki-1.3.9 wiki



The directory name of the wiki will be visible in your URL. I have found a way to prevent this, as I will explain later.

You don't need the tar.gz file in the website files anymore. You have two options: Either delete it or move it to your homedir, hidden from the Internet.




To delete the file: rm mediawiki-1.3.9.tar.gz

To move the file: mv mediawiki-1.3.9.tar.gz ~



Remember: ~ means your homedir and everything you put there is not online. A good place to store temporary backups lest you break up something during an installation!

Now do this to change the current directory:




cd wiki



There are some text files in this directory, like README, INSTALL and COPYING. Read them by issuing commands:




ls

less README (and then Q to exit)

less COPYING

etc



Don't lose too much time reading, because the SSH session will timeout!

Tip: You can autocomplete filenames by pressing TAB!

Now you have to decide how the URL of your wiki will look like. You can use two URLs:




http://wiki.mysite.tld

OR

http://www.mysite.tld/wiki



If you like the second URL best, then you just skip the section CREATING A SUBDOMAIN.

CREATING A SUBDOMAIN:

Be quick in order not to timeout your SSH session!!

Go to your Site Manager 2.0 and open the Domain Management tab.

Click on your main domain.

Click Add to create a subdomain.

Type wiki in the subdomain name.

Type /var/www/html/wiki in the directory.

Click Ok to create the subdomain and Logoff from SiteManager 2.0.

Note: You should create subdomains in case you install many MW-based wikis on your website due to cookie problems.

CONFIGURING THE WIKI:

Now go to your wiki via its URL. You will be asked to complete an installation and configuration form.

First, you need to decide on a good name for your wiki. Be creative!

Then you need to decide on a password for your root wiki account. Be obscure!

There is a question about the copyright of your wiki content. You can choose between GFDL (http://www.gnu.org/licenses/fdl.html) or CreativeCommons (http://www.creativecommons.org). You can also skip this question by not alloowing MW to include any copyright metadata. You can always change these settings later via the config file. If you need to do that, ask me to give you instructions.

MW needs a MySQL database. Actually version 4 is recommended but the 3.23 we have here on WestHost works well with MW 1.3.9. The web installer can create a database on the fly if you supply the database root password and the desired database name, mysql username and mysql database password.

Hit Install to continue with the installation. You may see some warning but don't pay attention unless you see an error.

After the webinstaller finishes, you need to go back to your SSH session and type:




cd config

mv LocalSettings.php ..

cd ..



This file is very important for your wiki. Keep a backup of it somewhere! It contains all the settings (well, most of them, MW's configuration is a bit strange).

CUSTOMISATION

You can customise the interface by visiting the All Messages page in the Special Pages section (the link is located lower left).

The wiki allows every Internet user to edit any wiki page. If you don't like this idea, there is a way to prevent it using the configuration file. Just ask me for further instructions.

There is a partial MW handbook (not always clear or accurate) here (http://meta.wikimedia.org/wiki/Help:Contents).

You can use my post under the CreativeCommons Attribution-NoDerivs 2.0 license (http://creativecommons.org/licenses/by-nd/2.0/).

Corrado Fiore
06-06-2005, 08:32 AM
Great tutorial, NSC!

I'll try it for one of my clients... sounds promising.

Thanks for sharing your work.

Cheers,
Corrado

goodwillstacy
12-17-2005, 04:28 PM
I would love the tutorial for installing TikiWiki! Any plans to post that soon? :)
stacy

goodwillstacy
12-17-2005, 05:25 PM
NSC,
I decided to install Media Wiki. Thanks for your tutorial- everything worked great with very little headache. :)
I would like to prevent any user from editing my wiki.. how would I go about this? I want to use it for internal stuff.

Thanks,
stacy

torrin
12-18-2005, 10:59 PM
I would like to prevent any user from editing my wiki.. how would I go about this?

Add this line to you LocalSettings.php file.


$wgGroupPermissions['*']['edit'] = false;

That will stop anonymous users from being able to edit. If you would like to stop people from creating accounts use this line.


$wgGroupPermissions['*']['createaccount'] = false;