Basic MediaWiki Installation: Difference between revisions

From SaruWiki
Jump to navigation Jump to search
(Working on config page description)
(Finished first version)
Line 5: Line 5:
* PHP5 (including php5-mysql)
* PHP5 (including php5-mysql)
Furthermore, you have the following credentials (name and password) or equivalent rights:
Furthermore, you have the following credentials (name and password) or equivalent rights:
* root (for installation)
* root (for installation and configuration of both MediaWiki and Apache2)
* MySQL root (for database creation)
* MySQL root (for MySQL database creation)
Update your APT sources, and run
Update your APT sources, and run
  apt-get install mediawiki
  apt-get install mediawiki
Line 16: Line 16:
Then restart or reload Apache2:
Then restart or reload Apache2:
  invoke-rc.d apache2 reload
  invoke-rc.d apache2 reload
Now the MediaWiki instance is being served on your webserver; you should be able to visit ''<nowiki>http://yourserver.lan/mediawiki</nowiki>'', and see the friendly MediaWiki sunflower, and a link to "Please set up the wiki first". Clicking this link will bring you to a single, long web page, that'll help you to actually create the Wiki instance. The first section contains the result of an environment check. It should end with the sentence "<span style="color:green">'''Environment checked. You can install MediaWiki.'''</span>". If not, then you'll first have to fix whatever is holding back your MediaWiki installation.
Now the MediaWiki instance is being served on your webserver; you should be able to visit ''<nowiki>http://yourserver.lan/mediawiki</nowiki>'', and see the friendly MediaWiki sunflower, and a link to "Please set up the wiki first".
==Configuring the Wiki instance==
Clicking the "Please set up the wiki first" link will bring you to a single, long web page, that'll help you to actually create the Wiki instance. The first section contains the result of an environment check. It should end with the sentence "<span style="color:green">'''Environment checked. You can install MediaWiki.'''</span>". If not, then you'll first have to fix whatever is holding back your MediaWiki installation.


The rest of the page is one long form. You'll have to provide all data to define your wiki. Questions are a.o.:
The rest of the page is one long form. You'll have to provide all data to define your wiki. Questions are a.o. the following.
* The Wiki name: Must not be blank or "MediaWiki" and may not contain "#". Preferably a short word without punctuation, i.e. "SaruWiki".
* Site Config questions:
* Contact e-mail: Displayed to users in some error messages, used as the return address for password reminders, and used as the default sender address of e-mail notifications.
** The Wiki name: Must not be blank or "MediaWiki" and may not contain "#". Preferably a short word without punctuation, i.e. "SaruWiki". Will appear as the namespace name for "meta" pages, and throughout the interface.  
* Language: determines the wiki interface localization. We only have experience with "en - English" but the pulldown list reveals an impressive list of languages, from "nl - Nederlands" to "jut - Jysk" and from "ak - Akan" to "yo - Yorùbá".
** Contact e-mail: Displayed to users in some error messages, used as the return address for password reminders, and used as the default sender address of e-mail notifications.
* the Copyright/license: you can have your Wiki display the GNU Free Documentation License, a Creative Commons license (that you'll have to select in a page under a hyperlink), or no license metadata at all. Think careful what you want with the materials that you and others create in your Wiki instance!
** Language: determines the wiki interface localization. We only have experience with "en - English" but the pulldown list reveals an impressive list of languages, from "nl - Nederlands" to "jut - Jysk" and from "ak - Akan" to "yo - Yorùbá".
* an Admin username and password: the proposed default is ''WikiSysop''
** the Copyright/license: you can have your Wiki display the GNU Free Documentation License, a Creative Commons license (that you'll have to select in a page under a hyperlink), or no license metadata at all. Think careful what you want with the materials that you and others create in your Wiki instance!
* Email address authentication: if this is enabled, then users have to confirm their e-mail address using a magic link sent to them whenever they set or change it, and only authenticated e-mail addresses can receive mails from other users and/or change notification mails. Setting this option is recommended for public wikis because of potential abuse of the e-mail features just above this particular question.
** an Admin username and password: the proposed default is ''WikiSysop''. Provide a strong password!
* Database type: You can choose from a list of one, being MySQL :-).
* Email notification and authentication setup:
* Database host: can be localhost, if you've installed MySQL on this same machine, but can also be an IP address or a DNS name to a remote MySQL server
** Email address authentication: if this is enabled, then users have to confirm their e-mail address using a magic link sent to them whenever they set or change it, and only authenticated e-mail addresses can receive mails from other users and/or change notification mails. Setting this option is recommended for public wikis because of potential abuse of the e-mail features just above this particular question.
* Database name: Here you choose under what name the database will be created in the MySQL server. The default is ''wikidb''.
* Database options:
** Database type: You can choose from a list of one, being MySQL :-).
** Database host: can be localhost, if you've installed MySQL on this same machine, but can also be an IP address or a DNS name to a remote MySQL server
** Database name: Here you choose under what name the database will be created in the MySQL server. The default is ''wikidb''.
** Database user: With the MySQL root privileges, we can have the MediaWiki configuration script create a new user within the new database, that has the necessary privileges to enter data in, and read data from, the MySQL database. The proposed name is ''wikiuser'', and you'll have to provide a strong (!) password.
** Superuser account: check the box to signal that you have a root account for the MySQL server, fill in the name (presumably 'root'') and the password, so that the configuration script gets the authority to create the ''wikidb'' database and all necessary users, tables et cetera.
* There are some MySQL specific options, most importantly:
** Database table prefix: If you need to share one database between multiple wikis, or between MediaWiki and another web application, you may choose to add a prefix to all the table names to avoid conflicts. Avoid exotic characters; something like mw_ is good. However, if you plan to have only a single wiki, then this box can remain empty.
** Storage Engine: choose between InnoDB and MyISAM. InnoDB is the default.
** Database character set: "Backwards-compatible UTF-8" is the default choice


Having provided all the above info, you can click the bottom button optimistically labeled "'''Install MediaWiki!'''". If you left something important empty (e.g. the Wiki name cannot be blank) or gave inconsistant information (two different passwords for "wikiuser"), you're thrown back to the same page with an urgent red box at the top:<br>
"<span style="color:red">'''Something's not quite right yet; make sure everything below is filled out correctly.'''</span>".<br>


Will appear as the namespace name for "meta" pages, and throughout the interface.
However, when you've gotten it right, you'll see a result page, ending with <span style="color:green">'''Installation successful!'''</span>


The installation also creates a
==Finishing up the configuration==
The above procedure has resulted in a new configuration file ''/var/lib/mediawiki/config/LocalSettings.php'' (owner: ''www-data:www-data''), and in a database in your MySQL server named as you've indicated (presumably ''wikidb'', right?).
As the result page indicated, you'll have to now move the ''LocalSettings.php'' file to ''/etc/mediawiki'', and set the permissions so that no-one can mess with that file:
cd /etc/mediawiki
mv /var/lib/mediawiki/config/LocalSettings.php .
chmod 444 LocalSettings.php
If you now follow the link to ''<nowiki>http://yourserver.lan/mediawiki</nowiki>'', you'll find yourself on the default start page of your new Wiki instance. You can immediately start using your Wiki, or you can add things like extensions.

Revision as of 15:18, 1 February 2009

Preparations

In the following, we'll assume you already have the following packages installed and configured:

  • Apache2
  • MySQL-server
  • PHP5 (including php5-mysql)

Furthermore, you have the following credentials (name and password) or equivalent rights:

  • root (for installation and configuration of both MediaWiki and Apache2)
  • MySQL root (for MySQL database creation)

Update your APT sources, and run

apt-get install mediawiki

This installs all mediawiki files, including a default configuration. For your convenience, we've created a MediaWiki directory structure map. If you run Apache2 (as we recommend), then that is automatically configured (for the most part) as well. By the way, you can reconfigure MediaWiki with dpkg-reconfigure, but that will only ask you for which web servers you'd like to generate a default configuration (those web servers being apache, apache-ssl, apache2 and cherokee). To get Apache2 to serve the Wiki on the default alias /mediawiki, edit /etc/mediawiki/apache.conf. Uncomment the alias line, so that the top of the file looks like this:

# Uncomment this to add an alias.
# This does not work properly with virtual hosts..
Alias /mediawiki /var/lib/mediawiki

Then restart or reload Apache2:

invoke-rc.d apache2 reload

Now the MediaWiki instance is being served on your webserver; you should be able to visit http://yourserver.lan/mediawiki, and see the friendly MediaWiki sunflower, and a link to "Please set up the wiki first".

Configuring the Wiki instance

Clicking the "Please set up the wiki first" link will bring you to a single, long web page, that'll help you to actually create the Wiki instance. The first section contains the result of an environment check. It should end with the sentence "Environment checked. You can install MediaWiki.". If not, then you'll first have to fix whatever is holding back your MediaWiki installation.

The rest of the page is one long form. You'll have to provide all data to define your wiki. Questions are a.o. the following.

  • Site Config questions:
    • The Wiki name: Must not be blank or "MediaWiki" and may not contain "#". Preferably a short word without punctuation, i.e. "SaruWiki". Will appear as the namespace name for "meta" pages, and throughout the interface.
    • Contact e-mail: Displayed to users in some error messages, used as the return address for password reminders, and used as the default sender address of e-mail notifications.
    • Language: determines the wiki interface localization. We only have experience with "en - English" but the pulldown list reveals an impressive list of languages, from "nl - Nederlands" to "jut - Jysk" and from "ak - Akan" to "yo - Yorùbá".
    • the Copyright/license: you can have your Wiki display the GNU Free Documentation License, a Creative Commons license (that you'll have to select in a page under a hyperlink), or no license metadata at all. Think careful what you want with the materials that you and others create in your Wiki instance!
    • an Admin username and password: the proposed default is WikiSysop. Provide a strong password!
  • Email notification and authentication setup:
    • Email address authentication: if this is enabled, then users have to confirm their e-mail address using a magic link sent to them whenever they set or change it, and only authenticated e-mail addresses can receive mails from other users and/or change notification mails. Setting this option is recommended for public wikis because of potential abuse of the e-mail features just above this particular question.
  • Database options:
    • Database type: You can choose from a list of one, being MySQL :-).
    • Database host: can be localhost, if you've installed MySQL on this same machine, but can also be an IP address or a DNS name to a remote MySQL server
    • Database name: Here you choose under what name the database will be created in the MySQL server. The default is wikidb.
    • Database user: With the MySQL root privileges, we can have the MediaWiki configuration script create a new user within the new database, that has the necessary privileges to enter data in, and read data from, the MySQL database. The proposed name is wikiuser, and you'll have to provide a strong (!) password.
    • Superuser account: check the box to signal that you have a root account for the MySQL server, fill in the name (presumably 'root) and the password, so that the configuration script gets the authority to create the wikidb database and all necessary users, tables et cetera.
  • There are some MySQL specific options, most importantly:
    • Database table prefix: If you need to share one database between multiple wikis, or between MediaWiki and another web application, you may choose to add a prefix to all the table names to avoid conflicts. Avoid exotic characters; something like mw_ is good. However, if you plan to have only a single wiki, then this box can remain empty.
    • Storage Engine: choose between InnoDB and MyISAM. InnoDB is the default.
    • Database character set: "Backwards-compatible UTF-8" is the default choice

Having provided all the above info, you can click the bottom button optimistically labeled "Install MediaWiki!". If you left something important empty (e.g. the Wiki name cannot be blank) or gave inconsistant information (two different passwords for "wikiuser"), you're thrown back to the same page with an urgent red box at the top:
"Something's not quite right yet; make sure everything below is filled out correctly.".

However, when you've gotten it right, you'll see a result page, ending with Installation successful!

Finishing up the configuration

The above procedure has resulted in a new configuration file /var/lib/mediawiki/config/LocalSettings.php (owner: www-data:www-data), and in a database in your MySQL server named as you've indicated (presumably wikidb, right?). As the result page indicated, you'll have to now move the LocalSettings.php file to /etc/mediawiki, and set the permissions so that no-one can mess with that file:

cd /etc/mediawiki
mv /var/lib/mediawiki/config/LocalSettings.php . 
chmod 444 LocalSettings.php

If you now follow the link to http://yourserver.lan/mediawiki, you'll find yourself on the default start page of your new Wiki instance. You can immediately start using your Wiki, or you can add things like extensions.