MediaWiki Install

From 金猪知识库
Jump to: navigation, search

前提是需要有php的运行环境。此处不描述这部分。MediaWiki特别忌用php 5.3.1,说是有bug。这需要注意。

首先参考这里下载代码,解压缩到目标路径。

对于我的这个wiki, 运行 http://wiki.lujun.info/config/index.php 即可。

然后就是问答式的安装过程,实际安装了就知道。这里就不截图解说了,主要是数据库信息之类。

装好后,我根据自己的需要修改了一下LocalSettings.php中的参数。

$wgLogo=""; # 这个参数可以修改wiki网站的左上角的图片。默认是菊花。建议图片大小135*135,可以支持PNG等透明图片类型
$wgGroupPermissions['*']['createaccount'] = false; # 关闭用户注册
$wgGroupPermissions['*']['edit'] = false; # 关闭匿名编辑功能
$wgGroupPermissions['someone']['edit'] = true; # 打开某用户的编辑功能。
LocalSettings.php中的参数具体说明见这里
$wgArticlePath = "/wiki/$1" # 修改URL格式为wiki.lujun.info/wiki/文章,这是大部分wiki站点的不成文规矩了。

对于上面的最后一行还需要修改以下文件来配合

  1. 对于有httpd.conf修改权限的,在httpd.conf中加入
    Alias /wiki /filesystem/path/to/you/site/index.php
    Alias /index.php /filesystem/path/to/you/site/index.php
  2. 对于只能修改.htaccess的,加入以下几行,需要有rewrite模块。
RewriteEngine on
#输入主域名wiki.lujun.info时直接转到wiki.lujun.info/wiki/Main_Page
RewriteRule ^/$ /wiki/Main_Page [R] 
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [L,QSA]

在我安装完1.15.2后没几天,收到MediaWiki的一封邮件说有了1.15.3的更新,是一次安全更新,邮件上这样说:
This is a security and bugfix release of MediaWiki 1.15.3 and MediaWiki 1.16.0beta2.

MediaWiki was found to be vulnerable to login CSRF. An attacker who controls a user account on the target wiki can force the victim to log in as the attacker, via a script on an external website. If the wiki is configured to allow user scripts, say with "$wgAllowUserJs = true" in LocalSettings.php, then the attacker can proceed to mount a phishing-style attack against the victim to obtain their password.

Even without user scripting, this attack is a potential nuisance, and so all public wikis should be upgraded if possible.

Our fix includes a breaking change to the API login action. Any clients using it will need to be updated. We apologise for making such a disruptive change in a minor release, but we feel that security is paramount.
既然是安全更新,那就一定要上了,赶紧下来了1.15.3的gz包,在邮件中也有一个diff文件可以让你直接应用在上一个版本也就是1.15.2上,但是我的空间不能让我用patch,所以我只能整个替换一次。

  1. 首先备份原来的1.15.2的程序和数据库。
  2. 上传1.15.3的程序文件。执行config/index.php
  3. 填写参数,完成安装。
  4. 覆盖老的LocalSetttings.php到新的程序目录下,即可。

关于知识库文章的格式,见这里

Personal tools