天天看点

使用MoinMoin搭建运维知识库[下文]-完善配置篇

<b> </b>

<a>#####################################################</a>

##如有转载,请务必保留本文链接及版权信息

##linux/unix网站运维技术!

##QQ:335623998

##E-mail:[email protected]

#####################################################

<b>3.6中文语言支持配置</b>

安装语言包,使用超级用户WikiAdmin

访问wiki语言设置页面,根据自己的域名而修改

选择安装简体中文语言包,会看到提示:附件'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'

…………略…………

<b>3.7 配置超级用户权限</b>

[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"

<b>3.8设置wiki在站点的目录</b>

[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

<b>3.9 配置时区</b>

在主配置文件 增加tz_offset = 8.0

tz_offset = 8.0

<b>3.10 E-mail 配置</b>

利用备机sendmail发送邮件,也可以使用第三方邮件系统

    # 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 &lt;[email protected]&gt;" [Unicode]

    #mail_from = u""

    mail_from = u"Wiki Notifier&lt;syswiki@syswiki&gt;" #发件人格式定义

    # "user pwd" if you need to use SMTP AUTH

    mail_login = "syswiki wiki"     #发件人用户名密码

<b>3.11 现在wiki线上配置汇总</b>

[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'&lt;img src="%s/common/moinmoin.png" alt="MoinMoin Logo"&gt;' % 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&lt;syswiki@syswiki&gt;"

    mail_login = "syswiki syswiki"

    navi_bar = [

        u'RecentChanges',

        u'FindPage',

        u'HelpContents',

    ]

    theme_default = 'modern'

    page_category_regex = ur'(?P&lt;all&gt;Category(?P&lt;key&gt;(?!Template)\S+))'

    page_dict_regex = ur'(?P&lt;all&gt;(?P&lt;key&gt;\S+)Dict)'

    page_group_regex = ur'(?P&lt;all&gt;(?P&lt;key&gt;\S+)Group)'

    page_template_regex = ur'(?P&lt;all&gt;(?P&lt;key&gt;\S+)Template)'

    show_hosts = 1

<b>3.12备份wiki数据</b>

建立备份目录

[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 &amp;&gt;/dev/null

ls -l /opt/backup/wiki-${DATE}.tgz

lftp 192.168.4.113 &lt;&lt;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"  &gt;&gt; /var/spool/cron/root

[root@syswiki ~]# crontab -l

01 01 * * * /root/scripts/back_syswiki

本文转自pandazhai 51CTO博客,原文链接:http://blog.51cto.com/dreamway/1148252

继续阅读