幫助:安裝指南

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/-

See also : Newcomers guide to installing on Windows or if you prefer IIS 6 try Installing MediaWiki on Windows Server 2003 SP1

MediaWiki can be difficult to install for the average computer user with little experience with server-based software. Most users who wish to use wiki software may benefit more from using a free wiki host (see a list of wiki hosts on Wikibooks). This page guides you through the process of installation.

Contents

[edit] Preparation

[edit] Minimum system requirements

The recommended minimum settings is 256MB of RAM for a single-computer website, although this will not suffice for a busy public site. Some users have reported slow performance on computers as low as 48MB of RAM.

[edit] Prerequisites

Before you can install MediaWiki, there are four prerequisite components you must install. When you install these, remember to read the associated documentation. If your website is hosted for you, contact the server administrators or hosting company to ensure these are installed.

  1. An Apache web server, available at the official download page.
  2. A recent version of PHP, the programming language in which MediaWiki is written. This is available from the official download page.
    • Note that some Linux servers may also require the equivalent mySQL package and PHP session management package; see the documentation available for the operating system.
  3. A MySQL database, which will be used to store all the text and data. This is available from the official download page.
    • Note that although there is experimental support for some other databases, this is preliminary and undocumented. MySQL is recommended over other databases.
  4. MediaWiki itself, which is available from the official download page. Development versions are available from the Sourceforge.net project page.

[edit] Uploading to the server

[edit] Download and uncompress

Download MediaWiki to your local computer and uncompress the files, so that you can see the files and folders. This is usually done with software such as WinZip on Windows. On Linux, you can untar the file using this command:

tar -xvzf mediawiki-*.tar.gz

[edit] Upload

Upload the files to a public directory (usually public_html/wiki) using an FTP client such as FileZilla. If you are using a Unix server and have access to the httpd.conf, make a Symbolic link.

Change the permission settings for the "config" subdirectory so that it is writable by the webserver. If you are using FileZilla, right-click on the directory, select "attributes...", and check "Write" under "Owner". If it prompts you for a number instead or you are using a command-line interface, use 755. Alternately, you may be able to change permissions using a "control panel" provided by your web host.

Depending on the server configuration, in some cases you have to check all boxes (777) in Filezilla, to be able to run the install-script of Mediawiki.

[edit] Troubleshooting

  • Case: If you are using a different FTP client than FileZilla, be sure to configure the client to not force uppercase or lowercase filenames on the webserver. MediaWiki filenames are case-sensitive.
  • Incomplete uploads: 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 an unreliable connection.
  • Internal error: If your webserver produces a "500 Internal Error" at the beginning of the install process, you may need to change the permissions on the config folder to 755.
  • SELinux: Linux distributions which supports SELinux ('Security Extensions') are becoming more widespread. On such systems, PHP scripts will still be unable to write to the config directory, after you have set the normal file permissions. You will also need to use the 'chcon' command to change the SELinux file type. Gallery install documentation describes this.

[edit] Installation

[edit] Create a MySQL database

The MySQL database will store the text and data of your wiki.

  • If you do know the root password, the MediaWiki setup script will create these automatically.
  • If you don't know the root password for your MySQL server (You most likely don't have the password if you are using a shared host), you need to manually create the new MySQL database and user. You can do using various "control panels" often available from shared hosts (see the corresponding documentation). Alternatively, contact your host provider.

[edit] Run the installation script

Visit the wiki directory to run the installation script. If you installed into public_html/wiki, this will probably be something similar to http://www.yourdomain.com/wiki. Depending on how you uploaded the files, you may need to visit http://www.yourdomain.com/wiki/config instead. Follow the installation instructions on the installation script page. Refer to the following table if you're uncertain what to enter.

Field Explanation
Database name The name of the MySQL database you created (see #Create a MySQL database).
Database username The username used for accessing your wiki MySQL database.
Database password The user password for accessing your wiki MySQL database.
Database table prefix An optional prefix to prepend to the name of every table that will be created within your wiki database. If you plan to have several wikis, you might want use the prefix "w1" so that all the tables associated with your first wiki will have "w1_" prepended. This allows you to install multiple wikis using the same databases by making the name unique (ie, the generic name "archive" becomes "w1_archive").
Root password The root database password if you have it. If you don't have it, enter the password you used to create your database and username.

Click the "Install!" button.

If you are using a hosting service, note that the database name and database username may have an extra 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.

[edit] Configuration

[edit] Local settings

After setup, a file called LocalSettings.php is created in the "config" directory. This file contains all the information needed by MediaWiki to run. If it does not find the file in the main folder, it will launch the installation script to create a new one in the "config" directory.

  1. Move this file to the main wiki directory (if you installed MediaWiki to public_html/wiki, move it there). Do not leave a copy in the config folder, as this poses a severe security risk.
  2. Delete the entire "config" directory.

[edit] Advanced configuration

For help with more advanced technical configuration, see Help:Configuration and Help:Administration.

For a brief overview that addresses the empty help pages and text and layout modification, see Help:Installation/Software Configuration.

[edit] Uninstallation

Removing MediaWiki entirely can be accomplished in two steps: removing the directory where MediaWiki was installed, and dropping the MediaWiki database from MySQL.

For example, if you installed MediaWiki to /var/www/mediawiki-xyz, you might do

rm -r /var/www/mediawiki-xyz

Then, using the mysql utility to interactively connect to MySQL as a user with adequate permissions, you would issue the following command at the mysql> prompt:

DROP DATABASE wikidb;

(If you needed to retain some tables, you could also drop just some of the tables individually. See this MediaWiki-L message for details.)

[edit] See also

[edit] External Links

  • Lopez, Daniel Sams Teach Yourself Apache 2 in 24 Hours. Excellent easy to use book, the 3rd chapter, which explains how to install Apache, can be viewed on Amazon.com here (must register with Amazon first to view pages)
  • An outdated explanation of how to install, configure, and get Apache 1.3, MySQL 3, PHP 4 running under Windows XP in less than 30 minutes. (This document is significantly out of date, having been updated October 5, 2003, but is otherwise well written!) For example, as of January 1, 2006:
    1. It references Apache 1.3, Apache 2.0 is current. The syntax it suggests for httpd.conf prevents Apache from restarting.
    2. It references PHP 4. PHP 5.1 is current.
    3. It references MySQL 3.23. MySQL 5.x is current.

For Windows XP, I think you may want to point users to a site similar to XAMPP for Windows. This appears to cover the basic requirements of Apache, PHP and MySQL.


[edit] Links to other help pages

Help contents
Meta | Wikinews | Wikipedia | Wikiquote | Wiktionary | commons: | mw: | b: | s: | mw:Manual | google
Versions of this help page (for other languages see below)
Meta | Wikinews | Wikipediahttp://en.wikipedia.org/wiki/%E5%B9%AB%E5%8A%A9:%E5%AE%89%E8%A3%9D%E6%8C%87%E5%8D%97 | Wikiquote | Wiktionary
What links here on Meta or from Meta | Wikipedia | MediaWiki
Reading
Go | Search | Stop words | Namespace | Page name | Section | Backlinks | Redirect | Category | Image page | Special pages | Printable version
Tracking changes
Recent changes (enhanced) | Related changes | Watching pages | Diff | Page history | Edit summary | User contributions | Minor edit | Patrolled edit
Logging in and preferences
Logging in | Preferences | User style
Editing
Starting a new page | Advanced editing | Editing FAQ | Edit toolbar | Export | Import | Shortcuts | Edit conflict | Page size
Referencing
Links | URLs | Piped links | Interwiki linking | Footnotes
Style and formatting
Wikitext examples | CSS | Reference card | HTML in wikitext | Formula | List | Table | Sorting | Colors | Images and file uploads
Fixing mistakes
Show preview | Testing | Reverting edits
Advanced functioning
Expansion | Template | Advanced templates | Parser function | Parameter default | Variable | System message | Substitution | Array | Calculation | Embed page
Others
Special characters | Renaming (moving) a page | Talk page | Sandbox | Legal issues for editors


Language: English
Personal tools

Variants
Actions
Navigation
Community
Beyond the Web
Print/export
Toolbox