Manual:Installing MediaWiki/zh

From MediaWiki.org

Jump to: navigation, search
Outdated IMPORTANT: The content of this page is outdated. Please check the English reference version. If you have checked or updated this page and found the content to be suitable, please remove this notice.
Mediawiki-logo.png 安装向导 | 关于 MediaWiki
Help-browser.svg 功能列表 | 安装要求
Preferences-system.svg 下载 | 安装 | 配置


MediaWiki 用一个互动的,基于Web的安装脚本来安装自己。在你能够运行这个脚本之前,你需要做一些事情。首先,确定你已经准备好了 安装环境 (Apache/IIS, MySQL4 or later and PHP5).然后,你必须有MediaWiki的软件包并且把MediaWiki上传到你的服务器。你也必须为你的wiki建立一个新的数据库。如果有必要的话,依照以下提示在你的网络服务器上建立一个帐户:创建系统帐户

对于没有Apache, PHP 和 MySQL使用经验的用户,MediaWiKi是很难安装的。 多数想要用wiki软件的用户或许会受益于用一个免费的wiki主机(见 wiki主机列表 在 Wikibooks).

Note Note: 有关故障排除信息, 见 Manual:Errors and Symptoms#Installation Errors.

Contents

下载 MediaWiki 软件

下载 MediaWiki 在这里 official download page 或者这里from subversion.

在你的服务器上解压缩.这项工作通常可以被如下软件完成:windows上可以选择7-Zip (free), WinZip, WinRAR 或者 IZArc (free) . 在 Linux 或者 Mac OS X上, 你可以用如下命令完成:

tar xvzf mediawiki-*.tar.gz

如果你还没有上传这些文件到你的网络服务器上,那么就现在照着做。 上传文件到你的网络服务器的网络目录上,你可以直接复制解压缩文件夹或使用FTP客户端 例如FileZilla (Open Source Software, Windows) 或者 Cyberduck (OSX). 如果你已经安装了 Apache, 那么正确的目录在你的 httpd.conf 文件中被指定出来了。 (这个文件通常在 <apache-folder>/htdocs里). 如果你正在用Linux 或者 Unix 操作系统你不必复制文件到你服务器上的网络目录,你可以通过创建一个从你的网络服务器的网络目录到这个文件夹的象征链接 来完成。

重命名上传的文件夹为任何一个显示在URL地址中的名字。举个例子来说:如果你的网络服务器正在运行,假如它的URL是http://localhost ,那么上传MediaWiki文件到网络目录中的/testwiki/ 目录将会意味着你将通过以下地址访问你的wiki网站http://localhost/testwiki/index.php

这个 (重命名的) 文件夹将被成为<MediaWiki-folder>文件夹.

编写目录

当MediaWiki在安装的时候,MediaWiki必须能够写入<MediaWiki-folder>/config目录。如果你还没有准备好,你必须改变config子目录的权限设置让它能够被网络服务器写入。如果你正在用FileZilla,右键点击config目录,选择"attributes...",然后check "Write" under "Owner".如果提示您输入号码或如果您使用的是命令行界面,那么使用755 (在linux上使用 777,除非你使用的是 RedHat Linux).或者,你可以通过使用你网站主机上提供的“控制面板”来更改权限。

根据不同的服务器设置,在某些情况下你必须勾选在FileZilla中的把所有项(777),以让MediaWiki的安装脚本运行。

在Unix 或是 Linux上,如果你有admin权限,你可以在你的wiki目录运行chmod 755 config命令

Note Note: MediaWiki 应该被安装到你文件根目录的一个子目录中,不应该安装到文件根目录中。举个例子来说,如果你的域名my.domain.org映射到文档根目录/home/mysqld/public_html,那么mediawiki将会被安装到/home/mysqld/public_html/w或相似的的文件夹之中。MediaWiki在这http://my.domain.org/w之下会变成可用了如果你想要应用short URLs这是非常重要的。

创建数据库

如果你知道你数据库的root密码,MediaWiki的安装脚本会为你创建一个新的数据库。如果情况是这样的话,你就可以跳过这一节直接阅读下面的运行安装脚本章节。如果你不知道root密码,比如你使用的是别人托管的服务器,那你现在就必须建立一个新的数据库。目前,你可以用MySQL 或 Postgres存储你wiki的实际内容

MySQL

  • 在安装MediaWiki之前,你必须创建MySQL数据库和一个用户。你可以通过用种类多样的控制面板来完成这项工作,例如:PhpMyAdmin,这是一个常常可以共享主机,可以用ssh登陆主机并且可以键入指令到MySQL提示中的MySQL管理面板,你可以参考相关的文件来了解如何运用它。或者,练习你的主机提供者为你创建一个帐户。
    1. 下载和安装MySQL 5.0它将会把自己安装到/usr/local/mysql
    2. 检查数据库服务器是否运行("/usr/local/mysql/bin/mysqladmin status")如果没有运行,sudo /usr/local/mysql/bin/safe_mysqld &.
      (For Fedora Core 5, use /usr/bin/mysqld_safe)
      1. 另一个最初开启MySQL服务的方法是运行在安装根目录的可用的配置脚本。它创建初始表并自动启动MySQL保护。
    3. 为你数据库服务器的"root"帐户设置密码,/usr/local/mysql/bin/mysqladmin -u root password yourpassword
    4. 为你的wiki站点在MySQL中设置一个用户--在你的终端这样操作:/usr/local/mysql/bin/mysql -u root -p mysql
    5. 这启动了MySQL的命令行客户端。现在,在客户端进行如下操作:
 create database wikidb;
 grant create, select, insert, update, delete, alter, lock tables on wikidb.* to 'wikiuser'@'localhost' identified by 'password';
 flush privileges;
 \q

如果你的数据库没有和你的网站运行在同一个服务器上,你必须给出相应的网站服务器主机名 -- 例如:mediawiki.example.com -- 如下:

 grant create, select, insert, update, delete, alter, lock tables on wikidb.* to
 'wikiuser'@'mediawiki.example.com' identified by 'password';

Postgres

If you are using Postgres, you will need to either have a database and user created for you, or simply supply the name of a Postgres user with "superuser" privileges to the configuration form. Often, this is the database user named postgres.

The database that MediaWiki will use needs to have both plpgsql and tsearch2 installed. The installer script will try to install plpgsql, but you may need to install tsearch2 yourself. (tsearch2 is used for searching the text of your wiki). Here's one way to do most of the setup. This is for a Unix-like system, and assumes that you have already installed the plpgsql and tsearch2 modules. In this example, we'll create a database named wikidb, owned by a user named wikiuser. From the command-line, as the postgres user, perform the following steps.

 createuser -S -D -R -P -E wikiuser (then enter the password)
 createdb -O wikiuser wikidb
 createlang plpgsql wikidb

Adding tsearch2 to the database is not a simple step, but hopefully it will already be done for you by whatever packaging process installed the tsearch2 module. In any case, the installer will let you know right away if it cannot find tsearch2.

The above steps are not all necessary, as the installer will try and do some of them for you if supplied with a superuser name and password.

For installing tsearch2 to the wikidb database under Windows, do the following steps:

  1. find tsearch2.sql (probably under .\PostgreSQL\8.x\share\contrib) and copy it to the postgresql\8.x\bin directory;
  2. from a command prompt at the postgresql\8.x\bin directory, type "psql wikidb < tsearch2.sql -U wikiuser";
  3. it will prompt you for the password for wikiuser;

That's it!

Point (2) seems only to work on windows, cause on debian linux 4.0 (etch) only user postgres is allowed to use language c. so there it must be called by:

su - postgres -c psql wikidb < tsearch2.sql

Afterwards you must grant select rights to wikiuser to the tsearch tables and insert the correct locale.

Warning If you use PostgreSQL 8.2 or early, you must replace “pg_ts_config” to “pg_ts_cfg” and "pg_ts_config_map" to "pg_ts_cfgmap" in the next commands.

su - postgres
psql -d wikidb -c "grant select on pg_ts_config to wikiuser;"
psql -d wikidb -c "grant select on pg_ts_config_map to wikiuser;"
psql -d wikidb -c "grant select on pg_ts_dict to wikiuser;"
psql -d wikidb -c "grant select on pg_ts_parser to wikiuser;"
psql -d wikidb -c "update pg_ts_cfg set locale = current_setting('lc_collate') where ts_name = 'default' and prs_name='default';"

Warning Last command does not work in PostgreSQL 8.3.

If you receive an error similar to "ERROR: relation "pg_ts_cfg" does not exist" when executing the above statements, try installing tsearch2 to the wikidb database again, but instead use these two separate steps (and then try the grant statements again):

1) su - postgres
2) psql wikidb -f tsearch2.sql

运行安装脚本

当以上所有步骤都完成了, 你可以跟着浏览器的提示完成安装了:Manual:Config script

[edit] 参考资料