使用Wiki來管理文檔是一種不錯的方法,這裏記錄一下安裝和配置TWiki的過程,參考材料http://wiki.yfang.cn/bin/view/Ywiki/Twiki%E5%AE%89%E8%A3%85%E6%94%BB%E7%95%A5
http://www.twiki.org/cgi-bin/view/TWiki/TWikiInstallationGuide#Basic_Installation
1,下載安裝包(當前版本已經是TWiki-5.1.1.tgz),在/data目錄下解開,得道/data/twiki目錄
2,重新部署htaccess文件
cp root-htaccess.txt .htaccess
cp pub-htaccess.txt pub/.htaccess
cp subdir-htaccess.txt lib/.htaccess
cp subdir-htaccess.txt data/.htaccess
cp subdir-htaccess.txt locale/.htaccess
cp subdir-htaccess.txt templates/.htaccess
cp bin/.htaccess.txt bin/.htaccess
3,配置LocalLib.cfg文件
cp bin/LocalLib.cfg.txt bin/LocalLib.cfg
根據實際lib路徑修改
$twikiLibPath = "/data/twiki/lib";
cp lib/TWiki.spec lib/LocalSite.cfg
4,配置bin/.htaccess文件
AuthUserFile /data/twiki/data/.htpasswd
cp twiki_httpd_conf.txt twiki.conf
<FilesMatch "configure.*">
SetHandler cgi-script
Order Deny,Allow
Deny from all
Allow from 127.0.0.1, 192.168.1.10
Require user admin
Satisfy Any
</FilesMatch>
5,建立系統管理賬戶
htpasswd -c data/.htpasswd admin
6,配置apache服務
cp twiki_httpd_conf.txt twiki.conf
cd /etc/httpd/conf.d
ln -s /data/twiki/twiki.conf twiki.conf
根據實際路徑修改twiki.conf文件,例如:
ScriptAlias /twiki/bin "/data/twiki/bin"
Alias /twiki/pub "/data/twiki/pub"
<Directory "/data/twiki/bin">
AuthUserFile /data/twiki/data/.htpasswd
<Directory "/data/twiki/pub">
#php_admin_flag engine off
7,修改文件宿主和權限
chown -R apache:apache /data/twiki
參考http://twiki.org/cgi-bin/view/TWiki/SettingFileAccessRightsLinuxUnix提供的腳本,在twiki目錄下新建access.sh文件
#! /bin/tcsh -f
set VERBOSE=-v
# Uncomment the following line to silence the output.
# set VERBOSE=
# These are the settings for Ubuntu.
set APACHE_RUN_USER=apache
set APACHE_RUN_GROUP=apache
chown -R ${VERBOSE} ${APACHE_RUN_USER}.${APACHE_RUN_GROUP} .
find . -type d -print0 | xargs -0 chmod ${VERBOSE} 755
find data -name '*.txt' -type f -print0 | xargs -0 chmod ${VERBOSE} 644
find data pub -name '*,v' -type f -print0 | xargs -0 chmod ${VERBOSE} 444
find lib locale -type f -print0 | xargs -0 chmod ${VERBOSE} 444
find pub -type f -print0 | xargs -0 chmod ${VERBOSE} 644
find bin -type f -print0 | xargs -0 chmod ${VERBOSE} 555
find templates bin/logos -type f -print0 | xargs -0 chmod ${VERBOSE} 444
find tools -type f -print0 | xargs -0 chmod ${VERBOSE} 555
chmod ${VERBOSE} 644 lib/LocalSite.cfg
chmod ${VERBOSE} 644 data/.htpasswd
chmod ${VERBOSE} 644 data/mime.types
chmod ${VERBOSE} 644 bin/LocalLib.cfg.txt bin/.htaccess.txt
chmod ${VERBOSE} 444 bin/setlib.cfg
chmod ${VERBOSE} 444 tools/extender.pl
chmod ${VERBOSE} 444 working/tmp/README working/README working/registration_approvals/README working/work_areas/README
chmod ${VERBOSE} 660 working/.htaccess
foreach file (AUTHORS COPYING COPYRIGHT index.html INSTALL.html LICENSE pub-htaccess.txt readme.txt robots.txt root-htaccess.txt subdir-htaccess.txt twiki_httpd_conf.txt)
if (-e $file) chmod ${VERBOSE} 444 $file
end
chmod +x access.sh,然後運行
8,啓動Apache
service httpd start
訪問http://localhost/twiki/bin/configure 檢查是否成功
在配置界面的Localisation選項下,勾選{UserInterfaceInternationalisation}、{Languages}{'zh-cn'}{Enabled}、{UseLocale}這幾項設置的複選框
設置{Site}{Locale}爲“zh_CN.UTF-8”,{Site}{CharSet}爲“UTF-8”
10,調試twiki
配置完成後,一些地方仍然不是很準確,需要根據apache的日誌(/etc/httpd/logs/error_log)進行調試
例如,頁面上的一些圖標無法正常現實的問題,根據apache日誌需要修改/data/twiki/pub/.htaccess文件,屏蔽下面內容
# Options None
# php_flag engine off
# AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
# FileETag MTime Size