Help:Installation

From GRWiktionaryHelp

MediaWiki Handbook: Contents | How To Use Help | Other help Software help for MediaWikiReaders, Editors, Admins e0 +/-


See also : Newcomers guide to installing on Windows

Installation instructions are hard to find,
I know they are here somewhere.
—Anonymous mediawiki's handbook reader

Contents

Before you install

Prerequisite tools

To install MediaWiki you need four components:

  • MySQL - an SQL database to store the Wiki text, user list etc.
  • Apache - a web server to serve the HTML web pages
  • PHP - the programming language that MediaWiki is written in. Fedora/Redhat users will also need the PHP-Mysql package. SUSE users also require the equivalent mysql package, php4-mysql and the PHP session management package, php4-session.
  • MediaWiki itself, which is a suite of programs written in PHP.

Note: there is experimental support for more databases: Postgres since 1.5, but no installer yet; Oracle support is tagged somewhere in cvs and under development. For webservers, users reported successful installation under Microsoft IIS and Lighttpd (see also: Installing MediaWiki with Lighttpd).

Minimum system requirements

Slow performance has been reported on systems where the whole site is on a single Pentium 133 with 48MB of RAM. 256MB is the recommended minimum amount of RAM for a single computer site but you're certain to need more for a busy public site. The Wikimedia Apache servers typically have 512MB to 1GB and the database servers 4GB.

Having spellchecker enabled

To have spelling installed, one must install ispell (or aspell, I now have both). This was not so evident on a server where it never works with graphical interface.

Then, to verify, open an edit window and begin editing

1. Download and uncompress (untar) the Wikipedia Files

Download the tarball setup file from: http://www.sf.net/projects/wikipedia

2. Upload them to your servers

Untar the file on your local machine and upload it into the web accessible folder (this is usually the htdocs directory on Apache webservers). You can place it in the root and if you have access to the httpd.conf, setup a symlink.

If you are using a hosting company, it is usually worth creating a directory under the /www/ folder in the filesystem, such as /wiki and upload all the files from your local drive into this folder.

  • Note: The pack includes a lot of files, spread over dozens of directories. Be careful when uploading. If the transfer is interrupted, you might have missing or incomplete files. You may have to retry your upload several times, especially if you have a slow connection.

3. Create a MySQL database

If you don't have root access on your server, you will need to create a MySQL database and a user for the database at your local host. After logging in as root, here is how we created the database user for our wiki installation:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'wikiuser'@'localhost'
    ->     IDENTIFIED BY 'wikiuser' WITH GRANT OPTION;

and then we created a database for the wiki:

mysql> CREATE DATABASE wikidb;

If you have root access, the setup file will ask you for the root password and automatically setup the database for you. See MySQL config for more details.

Make sure that you have set a password for your root mysql account. By default, no password is required. To change it start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h 'hostname' password 'new-password'

4. Change folders permissions

cd into the directory where the mediawiki files are. You will find index.php and the config directory. You need to make the config directory writable by the web server.

A good, secure way to do this is to see what group your web server process belongs to. On Debian, for example, this is www-data. Usually the web server process is "apache" and in order to see which groups the user "apache" belongs to you can run

groups apache (or groups <your_web_server_username>)

So you need to change the group of all files to www-data, and give group write access to the config directory:

cd /var/www/mediawiki-xyz

chown -R root:www-data *

chmod -R o-rwx *

chmod -R g+rw config



A simpler but very unsecure approach is to run the command chmod o+w config. For those of you who do not know what this means, you need to set the permissions (chmod) of the config directory to 777 so that it is world writable.

See your FTP client's instructions to figure out how to set permissions (E.g.: with the "Core FTP" client you simply right click on the config directory and select properties. A dialogue box will appear and easily allow you to change permissions to 777).

This can often be done by heading into your web host's control panel, and then into the file manager. If you are not allowed to set the permissions to 777, try setting it to 755 or 775 instead.

A better approach, if your web hosting server supports access control lists, is to run the command setfacl -d -m apache:rwx (be sure to replace "apache" with the name of the user your web server runs as). This grants access to just the webserver, not every user. You can later remove this access with setfacl -d -x apache config.

5. Visit your site

Visit the directory that wiki resides in. For example: if your domain is example.com and you are installing wiki in a folder called wikimedia, you will need to access http://example.com/wikimedia/ as this will lead you to the install page.

6. Answer questions

  • fill in your desired wikidb name etc
  • wiki site name
  • license metadata
  • database username
  • database name
  • database root password (you may not have this, this is the nice way to go, if you don't have this, you have to use another set of tools to create your db and username, or just tag tables on with another webapp!)

and submit.

If you are using a hosting service, please note that the database name and database username have a prefix (normally the userid given by your hosting provider). For example, if you have created a database named db01 with username u01 and your userid is ocom (given by your hosting provider), you should enter the database name and database username as ocom_db01 and ocom_u01 respectively.

7. Move LocalSettings.php

After setup, a file called LocalSettings.php is created in the config folder. You will need to MOVE(not to copy!) this file to the main wiki parent folder.

MediaWiki seeks LocalSettings.php in MediaWiki root directory. If LocalSettings.php exists, MediaWiki follows its configuration to run, otherwise ask user to do a installation for configuration again.

8. Set back permissions - IMPORTANT

chmod o-rwx config

You will need to set the permissions (chmod) of the config directory to 0600 so that only the owner can read and write to this file. It is important that this is done because not doing it will lead to security risks.


Question - The LocalSettings.php file is created by the web server with a+w permissions. Is it a security risk to leave it writeable by all users, or even the web server?
Guess? - Mine was just created 644, maybe this was changed/fixed or specific to your os / apache setup?
I believe it is not a security risk. If the permission is not 644, for instance 600 or so, then the web server would not be able to read the wiki's configuration. (the webserver runs with the permission "other")

If you move it instead of copying it, then it will be writable by the web server. It may indeed be safer, especially on a multiuser server without safe mode restrictions, to make it owned and writable only by yourself. It must however be readable by the web server or the system doesn't work. --brion 03:52, 27 Feb 2005 (UTC)

Question: I just installed the newest stable Mediawiki. After moving LocalSettings.php to the root directory its permissions is 666. This permissions is probably risky but in the article it is not mentioned what permissions LocalSettings.php should have. Does anyone know?

...and does anyone know how to change these permissions?

Question: Do you mind: You will need to set the permissions (chmod) the config directory to 600 (instead of 0600) ? --AmbroiseIngold 09:43, 8 Apr 2005 (UTC)

Historically, the chmod command used octal notation, so the leading 0 was significant. More recent versions of chmod will do the right thing without the leading 0. Actually, what he probably should have written instead was 0700. If you use 0600, the directory is not executable to the owner. 0700 is read+write+execute for owner. For directories this means that the owner is able to change current dir to it.

Also, nowadays, if you use a non-zero digit for the first of four, that controls the SUID/SGID/sticky settings. I don't know just how it worked back in the all-octal days, if they needed a fifth digit in there when they were setting S*ID bits or what. But the extra isn't purely a useless holdover these days. -- John Owens 20:54, 2005 August 1 (UTC)

It's still producing 0666/rw-rw-rw for me in 1.5beta4, so given others' statements that they got 644, I'd imagine it probably depends purely on your umask setting for the user your webserver runs as. And I do feel that there should be a note to check its permissions right alongside the note to move LocalSettings.php into the wiki root. --John Owens 20:54, 2005 August 1 (UTC)

My LocalSettings.php is also 666 (ooh, how devilish!); does anyone know how I can change this? Say's I'm not allowed like...

9. Customize style sheet

You can customize the logo in the top left hand side by replacing either stylesheets/images/wiki.png or stylesheets/monobook/images/wiki.png

Lately this is: skins/common/images/wiki.png.

The size is 135 px (width) by 155 px (height) (135x135 px with version 1.4).

However a better way to change it would be to use LocalSettings.php. Look for the variable "$wgLogo".

If your logo is bigger than 135 x 135 ( version 1.4 ) you have to resize it, because the logo hurts the web lay-out.

See also

MediaWiki Handbook: Contents | Other help


Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category | Special page
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit |
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | Wikitext | New page | List | Images/files | Image page | Special characters | Formula | Table | EasyTimeline | Template | Renaming / Moving a page | Editing shortcuts | Talk page | Testing | Export |

Wiki Projects: Wikibooks | Wikicommons | Wikipedia | Wikiquote | Wikisource | Wiktionary |