MediaWiki

出自Guoshuang Wiki

跳转到: 导航, 搜索

Template:ProjectInfo

Template:SourceBook

MediaWiki is a web-based wiki software application, used by InstallationWiki.org. Originally developed to serve the needs of the free content Wikipedia encyclopedia, today it has also been deployed by companies as an internal knowledge management solution, and as a Content Management System. Notably, Novell uses it to operate several of its high traffic websites.

MediaWiki is written in the PHP programming language, and can use either the MySQL or PostgreSQL relational database management system. Distributed under the terms of the GNU General Public License, MediaWiki is free software.

In this tutorial you will learn how to install MediaWiki on your local machine, which could be running either Windows or Linux, and also on a hosted web server. The installation process is very simple and easy to perform so let's quickly jump to it.

目录

Prerequisites

In order to install MediaWiki, we need the following components:

  • Web server (Apache or IIS)
  • Database server (MySQL version 4.0 and above or PostgreSQL 8.1 and above)
  • PHP 5.0 and above
  • The latest MediaWiki files

Since this tutorial is about MediaWiki, we are not going to learn about the installation of a web server, database server, or even PHP. We will assume that you have installed the latest version of Apache web server, MySQL database server, and the latest version of PHP on your machine. Please note that support for PostgreSQL is very new and not as well tested as that for MySQL, so we will only discuss MySQL here. We would also need to download the MediaWiki files which we will see in the next section.

Downloading MediaWiki

The latest version of MediaWiki can be downloaded at MediaWiki's downloads page: http://www.mediawiki.org/wiki/Download.

Note: When you download the MediaWiki ZIP file it will show an extension similar to .tar.gz. Make sure you retain this extension because some browsers tend to just keep a.tar extension at the end of the file, which can create problems while unzipping.

Upload the MediaWiki Files to your Server

When the download is complete, uncompress the .tar file. You can use the following command to uncompress the file on a Linux-based system:

tar -xvzf mediawiki-*.tar.gz

For a Windows-based system, you can use do the same using an extracting tool like WinZip or 7-Zip.

Once the extraction is complete you will have a folder named MediaWiki-*.

Note: The * symbol refers to the version used. In our case it will be MediaWiki-1.9.0

Now we have to move this folder to a web-accessible location, which will be referred as the "root" of our installation. For Apache, we will move it into the htdocs directory.

You can place it in the root, and if you have access to the httpd.conf file, you can make a symlink for the folder.

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

Note: MediaWiki filenames are case sensitive. So files should be named as they are in the extracted folder. The extracted file will generate a lot of files, spread over dozens of directories. Be careful when uploading them to a remote server. 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 an unreliable connection. It is very important to upload all the files to the server for proper operation.

Creating a MySQL Database

Since MediaWiki uses a MySQL database server, before installing MediaWiki in your system make sure you create a database for it. This will be easier if you have root access to your server. Let us call this database mediawiki. You can run the following command in your MySQL command window to create the database:

>CREATE DATABASE `mediawiki`;

It is also necessary to create a user to access this database. You can do this from your MySQL server on your local machine or in your hosted server. Let us create a user name wikiadmin to access this database.

Changing Permissions of the Config Folder

It is very important to know that, before starting the installation process, the config folder under the extracted folder must be writable. To make it so, go to the folder that contains the MediaWiki files for installation. You will see lots of folders there, with one named config. Make this directory writable, as the web server will write some setup files inside this folder during installation.

A simpler but much less secure approach is to run the chmod o+w config command. This means you need to set the permissions of the config directory to "world writable". This is the same as chmod 777.

Another way to change the permissions is to use your FTP clientread the help to figure out how to set the 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 allows you to change the permissions to 777).

Another way to set permissions is to use your web host's "control panel" to access the file manager functions. If you are not allowed to set the permissions to 777, try setting them to 755 or 775 instead.

Note: If you are not familiar with file permissions in a Linux system then chmod and 777 or 755 will not make any sense to you. To give you a brief idea, chmod is used to change file permissions. In general there are three types of user groups for a particular file or directory: owner, group, and others. Each of the user groups can have three permissions: read, write, and execute. These permissions are either on or off. So for each group we can write something like this as file permission in binary format: 111.

111 means for the particular group of users read permission is allowed (which is the first bit), write permission is allowed (the second bit), and also execution permission is allowed (the last bit). And 111 in binary format is equal to decimal 7. So a decimal value 5 (binary 101) will indicate that only read and execution permission is allowed. Now I believe 777 or 755 make sense to you. The first digit is for the owner, the second one is for the group, and the third one is for others. So a 755 permission means the owner will have all the privileges whereas the group and others will have only read and execution privileges and no write privileges.


The Installation Process

Open a web browser and visit the location where the wiki files reside. For the local machine just type the following URL in your web browser address bar (assuming that you are installing your wiki in a folder called mediawiki):

http://localhost/mediawiki/

If you are installing it on a hosting server, enter the domain name followed by your wiki installation folder to install the application. For example: if your site name is www.mysite.com, then you will open the URL www.mysite.com/mediawiki/ in your web browser.

Once you go to the URL specified, the page will lead you to the installation process. The installation process is very simple and easy to perform. Just perform the following steps:

1. When you go to the specified URL, you will see a welcome window similar to the following:

There is a link that says set up the wiki. Click this link to move to the next stage, which is the actual installation process.

2. When you are in the installation section, the installation script will automatically check for the environment settings and will show the status of the required programs and settings in the server. If all the requirements are met then you can proceed with the installation. A messageEnvironment checked. You can install MediaWikiwill be shown at the bottom of the environment checking section in order to indicate that. If anything is missing, then it will show a red error message and you need to fix it before continuing the installation process.

Here is the screen that will be shown for environment checking:

3. Scroll down to the Site configuration options. This is the main installation process file, so be careful while entering the details. You need to fill in the following:

Wiki name: This is used for setting up the site information. For the time being just enter www.mysite.com (used as an example) in the Wiki name box. This field is mandatory.

Contact e-mail field: If you want you can also put your email address in the Contact e-mail field, this email address will be used as a default address for password reminders and error reporting in the site.

Language: Choose the desired language support for your site from the list. The default is English.

Copyright /license: Based on your requirement you can choose any of the options provided in this section. For our setup we will use the default one (no license metadata).

Admin username and Password: This is the Sysop account information. A Sysop is a user with very high‑level system privileges such as locking and removing pages, blocking suspected IP addresses, and performing various setup tasks. You might be familiar with the terms owner and administrator for a site. Sysop is a synonymous term for administrator and owner. So this account information is very critical and must be filled out during the installation process.

Shared memory caching: If you have any shared memory set up for the server to cache pages, you can enter the information in the shared memory option field.

4. The next block of configuration is about E-mail, e-mail notification and authentication setup. This configuration enables general email setup, user to user email system, and email notification system setup. The installation file itself contains good explanation for the options. Before selecting any option, you can read the informational text below the option. For our setup we will keep the default settings as they are. You can configure your server the way you want.

5. Now we are in the most critical part of the setup, Database config. The database configuration section is the last but most important part of the whole installation process. Recall that a few pages back we set up a database in the MySQL database server for our wiki use.

We need to provide that information over here:

Database name: The name of the MySQL database you have created earlier. In this case the database we used is mediawiki.

DB username: The username used for accessing your wiki MySQL database.

DB password: The user password for accessing your wiki MySQL database.

Database table prefix: Though it is optional, it is a very good option to have a database table prefix. It allows you to install more than one wiki using the same databases. This option also gives you the opportunity to create MediaWiki tables under an existing database with the tables distinguished by our desired prefix. The last option is to provide a root password for the database. You can provide the information if you have it and click the Install MediaWiki! button. If you don't have the information then use the password you have used to create the database and user for the MediaWiki database.

Note: If you are using a hosting service, please note that the database name and database username may have a prefix (normally the userID given by your hosting provider). For example, if you have created a database named mediawiki with username wikiadmin and your userID for the site is mysiteid (given by your hosting provider), you should enter the database name and database username as mysiteid_mediawiki and mysiteid_wikiadmin respectively.

6. After providing all the information you are just a click away from installing MediaWiki. Click the Install MediaWiki! button to start the installation process, and sit back and wait for the server to finish the installation process. If something is wrong, then the server will come back to the setup page for the information. If all the information provided is correct then the server will take some time to set up the site. Usually the time taken is between 5 and 15 seconds. Once the installation is done, you will see a success message in greenInstallation successful!at the bottom of the page.

7. During the installation process a file named LocalSettings.php is created by the server. It is located under the config folder. To ensure that this file is created, we had to change the config folder's properties to make the folder writable. Before clicking the link to view the wiki homepage, move the LocalSettings.php file to the root folder. After doing so, you have to click on this link provided in the success page to start the wiki.

If the installation is successful, the following screen will be shown:

Note: Remember to move the LocalSettings.php file (not to copy the file) to the main wiki site. It is very important to move the LocalSettings.php file, because when you try to load MediaWiki site, if the file is still found in the config folder, then the system will assume that MediaWiki is not properly installed and it will show you the message that Localsettings.php file must be moved to the root directory.

First Look at our Installed Wiki Site

At the end of the installation success message, a link is provided to go to the installed wiki site. Click on this link for your first glance at the wiki site. You will see a window similar to this:

We can divide the first page into few categories. The first is the left navigation menu with the logo option including the toolbox and search box. The second is the main body section and the third is the footer section.


Source

The source of this content is Chapter 2: Installing MediaWiki of MediaWiki Administrators’ Tutorial by Mizanur Rahman (Packt Publishing, 2007).

Relevant Links

MediaWiki.org
Download MediaWiki

BitNami MediaWiki Stack - MediaWiki easy installer with Apache, MySQL and PHP.

本文永久地址:"http://wiki.guoshuang.com/MediaWiki"
个人工具
留言