##
如有转载,请务必保留本文链接及版权信息
##
linux/unix网站运维技术!
##QQ:335623998
##E-mail:335623998@qq.com
#####################################################
上文http://dreamway.blog.51cto.com/1281816/1147487介绍了知识库的部署、迁移、基本配置,此篇对MoinMoin配置进行完善及数据备份介绍。
3.6中文语言支持配置
安装语言包,使用超级用户WikiAdmin
访问wiki语言设置页面,根据自己的域名而修改
http://localhost/LanguageSetup?action=language_setup
选择安装简体中文语言包,会看到提示:附件'Simplified_Chinese--all_pages.zip'已安装。
修改默认语言为中文
[root@syswiki moin]# vim /opt/syswiki/share/moin/wikiconfig.py
…………略…………
# The main wiki language, set the direction of the wiki pages
language_default = 'zh'
…………略…………
3.7 配置超级用户权限
[root@syswiki moin]# vim /opt/syswiki/share/moin/wikiconfig.py
# IMPORTANT: grant yourself admin rights! replace YourName with
# your user name. See HelpOnAccessControlLists for more help.
# All acl_rights_xxx options must use unicode [Unicode]
#acl_rights_before = u"YourName:read,write,delete,revert,admin"
acl_rights_before = u"WikiAdmin:read,write,delete,revert,admin +AdminGroup:admin"
3.8设置wiki在站点的目录
[root@syswiki conf.d]# vim /opt/syswiki/share/moin/wikiconfig.py
# If you run your wiki script at /mywiki, you need to use this:
#url_prefix_static = '/mywiki' + url_prefix_static
url_prefix_static = '/syswiki' + url_prefix_static #
设置wiki在站点的目录,'/syswiki'表示http://url/syswiki
3.9 配置时区
在主配置文件 增加tz_offset = 8.0
[root@syswiki moin]# vim /opt/syswiki/share/moin/wikiconfig.py
…………略…………
tz_offset = 8.0
…………略…………
3.10 E-mail 配置
利用备机sendmail发送邮件,也可以使用第三方邮件系统
[root@syswiki moin]# vim /opt/syswiki/share/moin/wikiconfig.py
# Mail --------------------------------------------------------------
# Configure to enable subscribing to pages (disabled by default)
# or sending forgotten passwords.
mail_sendmail = '/usr/sbin/sendmail -t -i' #
发送邮件命令定义
# SMTP server, e.g. "mail.provider.com" (None to disable mail)
#mail_smarthost = ""
mail_smarthost = "localhost.localdomain" #
邮件服务器
# The return address, e.g u"Jn Wiki <noreply@mywiki.org>" [Unicode]
#mail_from = u""
mail_from = u"Wiki Notifier<syswiki@syswiki>" #
发件人格式定义
# "user pwd" if you need to use SMTP AUTH
mail_login = "syswiki wiki" #
发件人用户名密码
3.11 现在wiki线上配置汇总
[root@syswiki moin]# egrep -v "#|^$" wikiconfig.py
"""
MoinMoin - Configuration for a single wiki
If you run a single wiki only, you can omit the farmconfig.py config
file and just use wikiconfig.py - it will be used for every request
we get in that case.
Note that there are more config options than you'll find in
the version of this file that is installed by default; see
the module MoinMoin.config.multiconfig for a full list of names and their
default values.
Also, the URL http://moinmo.in/HelpOnConfiguration has
a list of config options.
** Please do not use this file for a wiki farm. Use the sample file
from the wikifarm directory instead! **
"""
import os
from MoinMoin.config import multiconfig, url_prefix_static
class Config(multiconfig.DefaultConfig):
wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
instance_dir = wikiconfig_dir
url_prefix_static = '/syswiki' + url_prefix_static
sitename = u'Hexun OPS Wiki'
logo_string = u'<img src="%s/common/moinmoin.png" alt="MoinMoin Logo">' % url_prefix_static
page_front_page = u"StartPage"
superuser = [u"WikiAdmin", ]
acl_rights_before = u"WikiAdmin:read,write,delete,revert,admin +AdminGroup:admin"
tz_offset = 8.0
mail_sendmail = '/usr/sbin/sendmail -t -i'
mail_smarthost = "localhost.localdomain"
mail_from = u"Wiki Notifier<syswiki@syswiki>"
mail_login = "syswiki syswiki"
navi_bar = [
u'RecentChanges',
u'FindPage',
u'HelpContents',
]
theme_default = 'modern'
language_default = 'zh'
page_category_regex = ur'(?P<all>Category(?P<key>(?!Template)\S+))'
page_dict_regex = ur'(?P<all>(?P<key>\S+)Dict)'
page_group_regex = ur'(?P<all>(?P<key>\S+)Group)'
page_template_regex = ur'(?P<all>(?P<key>\S+)Template)'
show_hosts = 1
3.12备份wiki数据
建立备份目录
[root@syswiki ~]# mkdir -p /opt/backup
建立脚本目录
[root@syswiki ~]# mkdir /root/scripts
备份脚本
[root@syswiki ~]# cat /root/scripts/back_syswiki
#backup syswiki
#!/bin/sh
DATE=`date +"%Y-%m-%d"`
WIKI_DIR=/opt/syswiki/share/moin/
tar czf /opt/backup/wiki-${DATE}.tgz $WIKI_DIR &>/dev/null
ls -l /opt/backup/wiki-${DATE}.tgz
lftp 192.168.4.113 <<EOF
login backdata vtt
cd syswiki
mput /opt/backup/wiki-*.tgz
exit
EOF
rm -f /home/backup/wiki-`date -d "1 week ago" +"%Y-%m-%d"`.tgz
配置计划任务
[root@syswiki ~]# echo "01 01 * * * /root/scripts/back_syswiki" >> /var/spool/cron/root
[root@syswiki ~]# crontab -l
01 01 * * * /root/scripts/back_syswiki
至此运维知识库搭建完毕,更多内容详见http://moinmo.in
本文转自pandazhai 51CTO博客,原文链接:http://blog.51cto.com/dreamway/1148252