How to install MediaWiki

Prerequisites

  • Apache web server
  • PHP 5.x
  • MySQL database server

Download and uncompress

  • Download MediaWiki
  • tar -xvzf mediawiki-*.tar.gz
  • 上傳到你想放的目錄 (通常是 public_html/wiki, 在這裡我們使用 /usr/share/mediawiki)
  • 改變 “config" 子目錄的權限成 755 or 777

Setup Virtual Host

  • 新增並編輯 /etc/apache2/site-available/doc 如下

    <VirtualHost *:80>

    ServerName doc.xxx.com

    ServerAdmin admin@xxx.com

    documentRoot /var/www/doc

    <Directory />

    Options None

    AllowOverride None

    allow from all

    </Directory>

    <Directory /var/www/>

    Options FollowSymLinks

    AllowOverride None

    Order allow,deny

    allow from all

    </Directory>

    ErrorLog /var/log/apache2/doc_error.log

    LogLevel warn

    CustomLog /var/log/apache2/doc_access.log combined

    ServerSignature On

    </VirtualHost>

  • Enable site
  • $ sudo ln -s /usr/share/mediawiki /var/www/doc
    $ sudo a2ensite doc
    $ sudo /etc/init.d/apache2 restart

Create a MySQL database

  • create database wikidb;
  • grant create, select, insert, update, delete, lock tables on wikidb.* to wiki@localhost identified by 'password';
  • flush privileges;

Run the installation script

  • 使用瀏覽器瀏覽剛設定好的 Virtual Host,開始設定
  • 需設定 Database table prefix (ex: “lu_" )
  • 設定完成後將 config 目錄下的 LocalSettings.php複製到 wiki 跟目錄下

Preventing Access

以下 code 都必須寫在 LocalSettings.php 中

  • 限制 anonymous users 讀取、編輯與新增使用者的權限

    $wgGroupPermissions['*']['edit'] = false;
    $wgGroupPermissions['*']['read'] = false;
    $wgGroupPermissions['*']['createaccount'] = false;

  • 限制 anonymous users 可以參訪的頁面 (此例為 Special:Userlogin )

    $wgWhitelistRead = array( "Special:Userlogin" )

參考資料

Help:Installation
LocalSettings.php
Preventing Access

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: