本站首页    管理页面    写新日志    退出


«July 2025»
12345
6789101112
13141516171819
20212223242526
2728293031


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7570649
建立时间:2006年5月29日




[网络与系统管理]Debian学习笔记7
软件技术

lhwork 发表于 2007/2/2 10:14:08

10.5. 安装Zope2.7 Zope是一个开源的、面向对象的Web服务器,主要用Python语言编写。在Debian平台上也有相应的软件包,安装方式也比其它平台简单很多。下面介绍一下Zope2.7的安装步骤: # apt-get install zope2.7 配置时会要回答几个问题,直接按回车选默认方式即可。软件会安装在/usr/lib/zope2.7目录下,实例目录是/var/lib/zope2.7/instance,实例目录开始为空,也就是说没有安装默认实例,需手动用mkzope2.7instanc程序安装。 用下面命令创建实例debian:~# mkzope2.7instanceQuick reminder:To run zope on an instance of type >=2.7 , use /var/lib/zope2.7/instance/<instance>/bin/runzopeTo start the server on the instance, use ' /var/lib/zope2.7/instance/<instance>/bin/zopectl start 'No instances were found in /var/lib/zope2.7/instanceYou may create one nowHit any key to go on, ctrl-c to stop #直接回车创建一个新实例Please choose a directory in which you'd like to installZope "instance home" files such as database files, configurationfiles, etc.Directory:/var/lib/zope2.7/instance/test # 指定test实例目录Please choose a username and password for the initial user.These will be the credentials you use to initially manageyour new Zope instance.Username: admin #创建zope初始用户 Password:Verify password:You may want to customize /var/lib/zope2.7/instance/<instance>/etc/zope.confdebian:~/instance# #test实例创建完成 启动实例debian:~#cd /var/lib/zope2.7/instance/test/bindebian:/var/lib/zope2.7/instance/test/bin#./zopectl start. daemon process started, pid=7811 #实例成功启动 实例启动后,就可用浏览器访问了,地址是http://localhost:9673。用创建实例时创建的始初用户和密码就可登录进管理界面进行系统管理。 10.6. 安装Zope 3.1.0b1 Zope 3.1.0b1是Zope 3第一个正式发布的版本,它取消了X代号,表示Zope 3已逐渐成熟,可用于产品开发。Debian的Sarge版软件包还没有包含Zope 3,所以只能从源码安装。具体的安装步骤如下: 首先,让我们来看一下Zope 3.1.0b1的系统要求。它要求Python 2.3.5或以上版本支持,并要安装有python-dev,该软件包提供编译Python模块所需的静态库、头文件和distutils工具。Debian默认是没有安装该软件包的,用apt-get install python-dev安装即可。如果没有python-dev软件包,在编译Zope 3时会出错,出错信息如下:error: invalid Python installation: unable to open /usr/lib/python2.3/config/Mak efile (No such file or directory)make: *** [build] 错误 1 我下载的打包源码文件名为Zope-3.1.0b1.tgz,用以下命令安装:debian:~/inst# tar zxvf Zope-3.1.0b1.tgzdebian:~/inst# cd Zope-3.1.0b1debian:~/inst/Zope-3.1.0b1# ./configure Configuring Zope 3 installationTesting for an acceptable Python interpreter...Python version 2.3.5 found at /usr/bin/pythonThe optimum Python version (2.3.5) was found at /usr/bin/python.debian:~/inst/Zope-3.1.0b1# make/usr/bin/python install.py -q builddebian:~/inst/Zope-3.1.0b1# make test #测试会出错,但也可安装/usr/bin/python install.py -q build/usr/bin/python test.py -vRunning UNIT tests at level 1Running UNIT tests from /root/inst/Zope-3.1.0b1/build/lib.linux-i686-2.3...............................................................................debian:~/inst/Zope-3.1.0b1# make install #默认安装到/usr/local/Zope-<version>目录/usr/bin/python install.py -q build/usr/bin/python install.py -q install --skip-build --home "/usr/local/Zope-3.1.0b1" 安装完成后,就要创建Zope实例。debian:/usr/local/Zope-3.1.0b1/bin# ./mkzopeinstancePlease choose a directory in which you'd like to install Zope'instance home' files such as database files, configuration files,etc.Directory: /var/lib/zope3.1.0b1 #输入实例的路径Please choose a username for the initial administrator account.This is required to allow Zope's management interface to be used.Username: admin #创建管理员Please provide a password for the initial administrator account.Password: #设置管理员密码Verify password:debian:/usr/local/Zope-3.1.0b1/bin# ./runzope&------2005-06-21T00:29:03 WARNING ZODB.FileStorage Ignoring index for /var/lib/zope3.1.0b1/var/Data.fs------2005-06-21T00:29:03 INFO PublisherHTTPServer zope.server.http (HTTP) started. Hostname: debian Port: 8080------2005-06-21T00:29:03 INFO PublisherFTPServer zope.server.ftp started. Hostname: debian Port: 8021------2005-06-21T00:29:03 INFO root Startup time: 17.049 sec real, 16.400 sec CPU 用浏览器访问http://localhost:8080/即可进入Zope 3,用刚才创建实例时设置的用户和密码即可以管理员身份登录ZMI。 Zope 3的安装已完成,Zope 3与Zope 2在设计思路上有很大的不同,我们需花时间熟悉一下Zope 3的管理界面和开发方法。 Zope3.1已发布,从源码编译安装的方法和上面介绍的一样。在Debian的Sid系统中已可用apt-get命令安装Zope3包了,大大简化了安装过程。 10.7. 安装MySQL数据库 MySQL是最著名的开源数据库,现在正在开发的5.0版将具有大量的新特性,如存储过程和事务处理等。MySQL的性能正一步步地迫近Oracle、DB2等商业大型数据库,给这些产品造成了很大的压力。 在Debian中安装MySQL服务器是很方便的,使用apt-get命令即可完成。debian:~# apt-get install mysql-server mysql-client mysql-server是服务器程序,mysql-client是客户端程序。我们可通过客户端程序来管理服务器,也可通过一些开源的GUI程序来维护服务器,如phpmyadmin,mysqlcc等。推荐使用phpmyadmin这个B/S的管理程序,通过浏览器就可方便高效地管理网络上的数据库。 有关MySQL数据库的管理的操作请参考本站的MySQL学习笔记。 10.8. 安装Samba服务器 Samba服务器是Linux平台上的Windows文件服务器和打印服务器,可供Windows用户或Linux用户共同使用,是Linux与Windows之间信息沟通的桥梁。安装命令如下:debian~:# apt-get install samba smbclient samba是服务器软件包,smbclient是客户端软件包,可选安装。Samba服务器的配置文件叫smb.conf,位于/etc/samba/目录下。在/usr/share/samba/目录下也有一个smb.conf文件备份,如果你在配置服务器时把/etc/samba/smb.conf改乱了,就可以用该文件来恢复到初始状态。启动脚本位于/etc/init.d/目录下,叫samba,如果修改了smb.conf配置文件,可用samba restart命令重启Samba服务器。 /etc/default/samba文件可设置samba服务器的启动方式,是daemons还是inetd,默认的设置是采用daemons方式的:# Defaults for samba initscript# sourced by /etc/init.d/samba# installed at /etc/default/samba by the maintainer scripts### This is a POSIX shell fragment## How should Samba (smbd) run? Possible values are "daemons"# or "inetd".RUN_MODE="daemons" 关闭服务器可用smbcontrol这个程序。命令格式如下:debian:~# smbcontrol smbd shutdown 为使Samba服务器正常使用,还需作一些设置。 在系统中创建test用户debian~:# useradd -m test 增加samba用户debian~:# smbpasswd -a test 500)this.width=500'> samba的用户名必须与Linux系统的用户名一致,但密码可以不同。用户登录Sabma服务器时的密码是使用sabpasswd程序设置的密码。 修改/etc/samba/smb.conf文件,把安全级别设置成用户级。这样,连接Samba服务器的每个用户都需提供用户名和密码。我们还要启用加密密码功能,这样NT以上的系统才能正常连接Samba服务器。下面是一个配置文件示例。## Sample configuration file for the Samba suite for Debian GNU/Linux.### This is the main Samba configuration file. You should read the# smb.conf(5) manual page in order to understand the options listed# here. Samba has a huge number of configurable options most of which# are not shown in this example## Any line which starts with a ; (semi-colon) or a # (hash)# is a comment and is ignored. In this example we will use a ## for commentary and a ; for parts of the config file that you# may wish to enable## NOTE: Whenever you modify this file you should run the command# "testparm" to check that you have not many any basic syntactic# errors.##======================= Global Settings =======================[global]## Browsing/Identification #### Change this to the workgroup/NT-domain name your Samba server will part of workgroup = DEBIAN_FANS# server string is the equivalent of the NT Description field server string = %h server (Samba %v)# Windows Internet Name Serving Support Section:# WINS Support - Tells the NMBD component of Samba to enable its WINS Server; wins support = no# WINS Server - Tells the NMBD components of Samba to be a WINS Client# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both; wins server = w.x.y.z# This will prevent nmbd to search for NetBIOS names through DNS. dns proxy = no# What naming service and in what order should we use to resolve host names# to IP addresses; name resolve order = lmhosts host wins bcast#### Debugging/Accounting ##### This tells Samba to use a separate log file for each machine# that connects log file = /var/log/samba/log.%m# Put a capping on the size of the log files (in Kb). max log size = 1000# If you want Samba to only log through syslog then set the following# parameter to 'yes'.; syslog only = no# We want Samba to log a minimum amount of information to syslog. Everything# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log# through syslog you should set the following parameter to something higher. syslog = 0# Do something sensible when Samba crashes: mail the admin a backtrace panic action = /usr/share/samba/panic-action %d####### Authentication ######## "security = user" is always a good idea. This will require a Unix account# in this server for every user accessing the server. See# /usr/share/doc/samba-doc/htmldocs/ServerType.html in the samba-doc# package for details. security = user# You may wish to use password encryption. See the section on# 'encrypt passwords' in the smb.conf(5) manpage before enabling. encrypt passwords = yes# If you are using encrypted passwords, Samba will need to know what# password database type you are using. passdb backend = tdbsam guest obey pam restrictions = yes; guest account = nobody invalid users = root# This boolean parameter controls whether Samba attempts to sync the Unix# password with the SMB password when the encrypted SMB password in the# passdb is changed.; unix password sync = no# For Unix password sync to work on a Debian GNU/Linux system, the following# parameters must be set (thanks to Augustin Luton <aluton@hybrigenics.fr> for# sending the correct chat script for the passwd program in Debian Potato). passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .# This boolean controls whether PAM will be used for password changes# when requested by an SMB client instead of the program listed in# 'passwd program'. The default is 'no'.; pam password change = no########## Printing ########### If you want to automatically load your printer list rather# than setting them up individually then you'll need this; load printers = yes# lpr(ng) printing. You may wish to override the location of the# printcap file; printing = bsd; printcap name = /etc/printcap# CUPS printing. See also the cupsaddsmb(8) manpage in the# cupsys-client package.; printing = cups; printcap name = cups# When using [print$], root is implicitly a 'printer admin', but you can# also give this right to other users to add drivers and set printer# properties; printer admin = @ntadmin######## File sharing ######### Name mangling options; preserve case = yes; short preserve case = yes############ Misc ############# Using the following line enables you to customise your configuration# on a per machine basis. The %m gets replaced with the netbios name# of the machine that is connecting; include = /home/samba/etc/smb.conf.%m# Most people will find that this option gives better performance.# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/speed.html# for details# You may want to add the following on a Linux system:# SO_RCVBUF=8192 SO_SNDBUF=8192 socket options = TCP_NODELAY# The following parameter is useful only if you have the linpopup package# installed. The samba maintainer and the linpopup maintainer are# working to ease installation and configuration of linpopup and samba.; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &# Domain Master specifies Samba to be the Domain Master Browser. If this# machine will be configured as a BDC (a secondary logon server), you# must set this to 'no'; otherwise, the default behavior is recommended.; domain master = auto# Some defaults for winbind (make sure you're not using the ranges# for something else.); idmap uid = 10000-20000; idmap gid = 10000-20000; template shell = /bin/bash#======================= Share Definitions =======================[homes] comment = Home Directories browseable = yes# By default, the home directories are exported read-only. Change next# parameter to 'yes' if you want to be able to write to them. writable = no# File creation mask is set to 0700 for security reasons. If you want to# create files with group=rw permissions, set next parameter to 0775. create mask = 0700# Directory creation mask is set to 0700 for security reasons. If you want to# create dirs. with group=rw permissions, set next parameter to 0775. directory mask = 0700# Un-comment the following and create the netlogon directory for Domain Logons# (you need to configure Samba to act as a domain controller too.);[netlogon]; comment = Network Logon Service; path = /home/samba/netlogon; guest ok = yes; writable = no; share modes = no[printers] comment = All Printers browseable = no path = /tmp printable = yes public = no writable = no create mode = 0700# Windows clients look for this share name as a source of downloadable# printer drivers[print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes guest ok = no# Uncomment to allow remote administration of Windows print drivers.# Replace 'ntadmin' with the name of the group your admin users are# members of.; write list = root, @ntadmin# A sample share for sharing your CD-ROM with others.;[cdrom]; comment = Samba server's CD-ROM; writable = no; locking = no; path = /cdrom; public = yes# The next two parameters show how to auto-mount a CD-ROM when the# cdrom share is accesed. For this to work /etc/fstab must contain# an entry like this:## /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0## The CD-ROM gets unmounted automatically after the connection to the## If you don't want to use auto-mounting/unmounting make sure the CD# is mounted on /cdrom#; preexec = /bin/mount /cdrom; postexec = /bin/umount /cdrom[d]writable = yespath = /mnt/hda5valid users = root #指定有效用户,只有root用户能访问该共享目录。create mask = 0660directory mask = 0770 这样,最基本的Samba服务器就设置好了,在Windows上就可用test用户名访问Samba服务器上的/home/test目录了。我们还设置了一个共享目录d,指向本机的/mnt/hda5目录。该共享只能由root用户访问。当然,同test用户一样,在连接前要先用smbpasswd -a root命令创建叫root的samba用户。在Linux下我们可以用smbclient //samba_server/sharename命令访问samba服务器共享目录。 Samba服务器的功能是很强大的,有关Samba服务器的详细配置和使用介绍请参考网站上的Samba学习笔记。 10.9. 设置磁盘配额 我们可通过quota来设置磁盘的配额,限定某个用户只能使用有限的硬盘空间,这在文件服务器和邮件服务器上是很常用的。Linux通过quota程序支持磁盘配额,它以分区(partition)为单位进行设置的。设置步骤如下: 确定内核支持quota功能,然后下载安装quota程序。debian:~# apt-get install quota 修改/etc/fstab文件,在分区上启用quota功能。我的home目录是放到一个单独的分区中的,我现在要在该分区中启用quota,则需把fstab中的:LABEL=/home /home ext3 defaults 1 2 改成:LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2 usrquota和grpquota是新增的内容,表示在该分区内启用用户配额(usrquota)和组配额(grpquota)。用户配额可限制某个用户可使用的磁盘空间,组配额可限制某个组所有成员总共可使用的磁盘空间。 重新启动系统或重新安装分区,使fstab里的配置生效,我们可查看/etc/mtab文件以确定我们的修改是否生效,下面是一个生效后mtab文件。debian:~#mount -a -o remount #重新安装分区debian:~# vi /etc/mtab/dev/sda1 / ext3 rw 0 0none /proc proc rw 0 0usbdevfs /proc/bus/usb usbdevfs rw 0 0none /dev/pts devpts rw,gid=5,mode=620 0 0/dev/sda2 /home ext3 rw,usrquota,grpquota 0 0 #启用了quotanone /dev/shm tmpfs rw 0 0/dev/sda3 /usr ext3 rw 0 0/dev/sda6 /data ext3 rw 0 0 运行quotacheck程序收集磁盘资料,并在/home目录下生成aquota.group和aquota.user文件。debian:~# quotacheck -avug 如果出现# quotacheck: Cannot get quotafile name for /dev/sda1的情况,请先手工在/home目录下创建这两个文件,然后再运行上面这个命令。debian:/home#touch aquota.group;touch aquota.user 这是quota的一个Bug,但不影响正常使用。 现在我们可以启动quota了,执行以下命令即可。debian:~# quotaon -av 接下来要针对用户设置配额了,我们可使用edquota命令来做。debian:~# edquota -u testDisk quotas for user test (uid 513):Filesystem blocks soft hard inodes soft hard /dev/sda2 28 0 0 6 0 0 这是test用户还没设置配额时的情况,soft表示软限制,当我们使用磁盘时可以超过该值,但要在指定的期间内将磁盘的容量降到soft以下;hard表示硬限制,用户使用磁盘是绝对不能超过该值的。所以soft的值是要低于hard值的,相当于给用户一个缓冲的区间。这里有两对soft和hard,前一对以blocks为单位设置,后一对以inodes为单位设置,一般使用blocks为单位。设置完成后的情况如下。Disk quotas for user test (uid 513):Filesystem blocks soft hard inodes soft hard /dev/sda2 28 20480 30720 6 0 0 设置的容量是以K为单位的,这里的软限制设置了20M,硬限制设置了30M。 设置soft的宽限期间用edquota -t命令,该设置是针对分区设置的,不能细化到用户。 quotaoff命令用来关闭quotaoff,在关机或重启机器时,请先用该命令关闭quota。 quotastats命令可显示quota的状态信息。 repquota命令可用来显示分区中各用户的配额使用情况。 10.10. 安装OpenLDAP目录服务器 在Debian系统中安装openldap是很简单的,它有一个配置向导可帮我们快速建立一个目录服务。安装命令如下:debian:~# apt-get install slapd ldap-utils 与目录服务相关的软件包系统会自动安装。安装完成后,系统会自动运行一个配置向导,依次回答以下问题即可:Domain name #目录的根Organization name #根下的组织Admin password #目录服务器的管理员密码Verify password #验证密码Allow LDAPv2 protocol #是否允许LDAPv2 配置完成后,可用以下命令测试目录服务器:debian:~# ldapsearch -x -b 'cn=admin,dc=com'# extended LDIF## LDAPv3# base <cn=admin,dc=com> with scope sub# filter: (objectclass=*)# requesting: ALL## admin, comdn: cn=admin,dc=comobjectClass: simpleSecurityObjectobjectClass: organizationalRolecn: admindescription: LDAP administrator# search resultsearch: 2result: 0 Success# numResponses: 2# numEntries: 1 dc=com是我的目录服务器的根,cn=admin,dc=com是我的目录服务器的根管理员。这个管理员在我的目录服务器中拥有像Linux系统中root一样的权限。 推荐使用phpldapadmin这Web管理程序来管理ldap服务器。有关openldap的详细配置说明和使用请参考网站上的openldap学习笔记。 10.11. 安装HylaFAX传真服务器 HylaFAX是一个开放源码的传真服务器,它可为企业提供一个强大而可靠的传真服务。HylaFAX基于C/S架构,在局域网内只要有一台连接FAX Modem的HylaFAX传真服务器,就可为局域网内所有的用户提供传真功能。作为企业应用,高负载能力是必须具备的,HylaFAX可连接多台Modem,为企业提高优异的传真性能。 10.11.1. 安装 在Debian系统中提供一个HylaFAX-server软件包,用以安装HylaFAX服务器。在安装该软件包前,请用上文介绍的工具和方法确定Modem在你的Debian系统中能正常工作。下面是具体的安装步骤: 安装服务器软件包和一些工具软件:debian:~# apt-get install hylafax-server hylafax-client 安装完软件包后,hylafax还不能运行,还要运行faxsetup命令配置你的传真服务器。该配置过程会检测Modem的传真功能并要求输入传真机的一些参数,如国家码、地区码和本机号码等。最后faxsetup还会生成一个faxmaster的用户,该用户负责管理传真服务器。配置完成后,HylaFAX服务应该已启动了,以后每次重启动服务器都会自动运行。 HylaFAX的启动脚本名叫hylafax,位于/etc/init.d/目录下。在该目录下运行./hylafax start命令可以手动启动HylaFAX传真服务器。HylaFAX正常启动后会产生三个进程,用ps命令可以查看:uucp 5139 0.0 0.4 6976 1392 ? Ss 16:53 0:00 /usr/sbin/faxquucp 5141 0.0 0.3 4372 1116 ? Ss 16:53 0:00 /usr/sbin/hfaxd -i 4559uucp 5149 0.0 0.6 7088 2004 pts/2 S 16:53 0:00 /usr/sbin/faxgetty ttyS0 现在,我们可用faxstat命令来查询服务器状态。debian:~# faxstatPassword:HylaFAX scheduler on debian: RunningModem ttyS0 (85789877): Running and idle 出现以上信息说明服务器已正常运行,我们可用sendfax命令来测试一下发送传真。debian:~# sendfax -n -d 88886666 test.ps test.txt文档就通过我们的HylaFAX传真服务器发送到88886666传真机上了。我们可到/var/spool/hylafax/log查看发送的日志。 接收的传真会自动保存在/var/spool/hylafax/recvq目录下,文件格式是tif的。tif是一种图形文档格式,我们可以用支持tif文档格式的看图软件直接打开,有些看图软件打开tif会变形,而Windows自带的图片查看器可以完美支持tif文档。我们也可以用fax2ps程序把tif格式文档转换到ps格式文档,再用ghostview浏览。 传真服务器已安装完成,但要在企业中投入正常使用,还需进一步的配置。 10.11.2. 配置 hylafax的配置文档位于/etc/hylafax目录下,而实际的工作目录是/var/spool/hylafax,接收到的传真和一些日志信息都保存在该目录。该目录下还有一个etc目录,内容与/etc/hylafax的一样,但我们不要手动修改这个目录中的配置文件,而是要修改/etc/hylafax目录下的,否则启动服务器会出错。每当我们修改了/etc/hylafax目录的配置文件后,重启hylafax都会自动把/etc/hylafax中修改过的文件拷贝到/var/spool/hylafax/etc/目录,完成同步。 /etc/hylafax目录下几个重要的配置文件说明: hfaxd.conf,HylaFAX Client-Server Protocol Configuration。 hyla.conf,System-wide client configuration file config.ttyS0,FAX端口的配置文件。 faxaddmodem,用于添加或修改Modem配置 用info hylafax-config命令可以查看config.ttyS0的配置参数说明。下面是我的config.ttyS0配置文件的内容。我的Modem是一个外置的Modem,接到COM1上。CountryCode: 86 #国际区号AreaCode: 020 #国内区号FAXNumber: 85528685 #传真号码LongDistancePrefix: 1InternationalPrefix: 011DialStringRules: /etc/hylafax/dialrulesServerTracing: 1SessionTracing: 11RecvFileMode: 0600 #接收到的传真文档的访问权限LogFileMode: 0600 #日志文档的访问权限DeviceMode: 0600 #设备的访问权限RingsBeforeAnswer: 4 #响4声后才开始传真SpeakerVolume: offGettyArgs: "-h %l dx_%s"LocalIdentifier: "NothingSetup"TagLineFont: etc/lutRS18.pcfTagLineFormat: "From %%l|%c|Page %%P of %%T"MaxRecvPages: 25### Modem-related stuff: should reflect modem command interface# and hardware connection/cabling (e.g. flow control).#ModemType: Class1 # use this to supply a hintModemRate: 19200 # rate for DCE-DTE communicationModemFlowControl: rtscts # default#ModemNoFlowCmd: AT&K0 # setup no flow controlModemHardFlowCmd: AT&K3 # setup hardware flow controlModemSoftFlowCmd: AT&K4 # setup software flow controlModemSetupDTRCmd: AT&D2 # setup so DTR drop resets modemModemSetupDCDCmd: AT&C1 # setup so DCD reflects carrier (or not)#ModemMfrQueryCmd: !RockwellModemModelQueryCmd: !RC288DPiModemRevQueryCmd: ATI3 # product information#ModemDialCmd: ATDT%s # T for tone dialing 如果使用分机,在发送传真前要先拔一个号码。以拔号码9为例,则应该这样设置:1、不检测拔号音,2、设置:ModemDialCmd: ATDT9W%s。 faxadduser,添加用户,这里指的用户是指访问HylaFAX传真服务的用户,和系统用户是不同的。 probemodem,用于检测Modem信息。 xferfaxstats可显示发送传真的统计信息。recvstats可显示接收传真的统计信息。 手动模拟收到传真后的自动处理过程,通过这种模拟我们可以测试faxrcvd脚本。debian:#~ cd /var/spool/hylafaxdebian:#~ ./bin/faxrcvd recvq/fax000000011.tif ttyS0 "000000032" "" 000000032是接收ID号,log目录下的日志文件名就是由字母"c"+接收ID号组成的。 http://www.hylafax.org/howto/faxrcvd/中有几个转换pdf格式文档和发送邮件的faxrcvd脚本可供参考。 10.12. 安装Jabberd服务器 Jabber是一个IM(即时通信)服务器,使用开放的XMPP协议,它的信息流是XML格式的,可实现跨平台通信。通过Jabber转换器,Japper还可与MSN,Yahoo等即时通信服务器连接。一举打破现时IM平台互不兼容的格局。Google talk就是使用Jabber/XMPP来实现的。 Jabber服务器软件有很多种,具体可到这个网址查询:http://www.jabber.org/software/servers.shtml。其中jabberd是用C写的一个Jabber服务器,在Debian中有一个jabber软件包可安装jabberd1.4.3服务器。现在最新的jabberd是2.x版本的,包含了jabber的最新功能,但支持的组件较少,jabberd1.4.x版本中没有包含最新的功能,如不支持SASL。但它的支持组件很多,而且很稳定。所以这里我以jabberd1.4.3版的jabberd服务器进行介绍。 用Debian标准的软件安装方法即可完成软件包的下载和安装。debian:~# apt-get install jabber 安装完软件后,jabberd服务就会自动启动。我们可用telnet程序与服务器连接测试一下服务器是否能正常工作。debian:~# telnet localhost 5222 #5222是jabberd服务的默认端口号Trying 127.0.0.1...Connected to localhost.Escape character is '^]'. 在上面的状态下输入以下xml文本内容:<stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'> 按回车,jabber服务器会显示如下信息:<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='431E92B1' xmlns='jabber:client' from='localhost'> 如果出现如下的信息,则说明jabberd服务器已正常运行。我们可用</stream:stream>语句关闭信息流,退同telnet状态。。 下面我们可以开始配置jabber服务器。jabber的配置文件在/etc/jabber目录下,叫jabber.xml。首先,我们需配置主机名,上面我们是用localhost主机名来测试的。正式使用的话需要有一个唯一的名称来标识该服务器。用vi程序打开该文件,找到这句: <host><jabberd:cmdline flag="h">localhost</jabberd:cmdline></host> 把localhost改成你的主机名,我的主机名是debian,存盘退出。现在我们就可用主机名来访问jabberd服务了,如:debian:~# telnet debian 5222Trying 127.0.0.1...Connected to debian. #主机名已改变Escape character is '^]'. 现在我们可以添加一个jabber帐号了,我们可以通过gaim之类的jabber客户端软件自动添加,也可手动方法添加。下面介绍用telnet手动添加的方法,这种方法可让我们详细了解jabberd服务的添加用户的处理过程。debian:~# telnet debian 5222Trying 127.0.0.1...Connected to debian.Escape character is '^]'.<stream:stream to="debian"xmlns="jabber:client"xmlns:stream="http://etherx.jabber.org/streams"> 系统显示以下信息:<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='431E9B0B' xmlns='jabber:client' from='debian'> 使用以下XML查询注册需提供些什么信息:<iq id='reg1' type='get'> <query xmlns='jabber:iq:register'/></iq> 查询的结果如下:<iq id='reg1' type='result'> <query xmlns='jabber:iq:register'><password/><password/> <instructions>Choose a username and password to register with this server.</instructions> <name/> <email/> <username/></query></iq> 这里显示注册需提供password,username,email和name四项信息。下面我把按要求把注册信息发给服务器:<iq id="reg2" type="set"><query xmlns="jabber:iq:register"><username>test</username><password>12345</password><name>test</name><email>test@debian</email></query></iq> #在这里按回车,如果出现以下信息,则说明注册成功。<iq id='reg2' type='result'/> 每个注册用户的信息保存在/var/lib/jabber/目录下。现在我们可以用刚注册的帐号登录jabber服务器了,在登录之前,我们可用以下XML命令查询服务器登录需要些什么信息:<iq id="auth1" type="get"><query xmlns="jabber:iq:auth"><username>test</username></query></iq> 返回的信息如下:<iq id='auth1' type='result'><query xmlns='jabber:iq:auth'><username>test</username><digest/><password/><resource/></query></iq> <digest/>和<password/>分别表示加密格式的密码和纯文本格式的密码,只需选其中一种即可。<resource>是必须填的,表示连接服务的资源,如我们现在采用的telnet。登录的XML命令如下,我们采用的是不加密的密码方式:<iq id="auth2" type="set"><query xmlns="jabber:iq:auth"><username>test</username><password>12345</password><resource>telnet</resource></query></iq> #这里按回车,如果出现以下信息,则说明登录成功。<iq id='auth2' type='result'/> 最后,我们要把test用户切换到在线状态。<presence/> #按回车后会显示以下的欢迎信息<message from='debian' to='test@debian'> <subject>Welcome!</subject> <body>Welcome to the Jabber server -- we hope you enjoy this service! For information about how to use Jabber, visit the Jabber User&apos;s Guide at http://jabbermanual.jabberstudio.org/</body> <x xmlns='jabber:x:delay' from='test@debian' stamp='20050907T08:01:29'>Offline Storage</x></message> 现在,我们就可发送和接收信息了。发送信息的XML命令格式如下:<message to="jims@debian"><body>hello jims</body></message> 如果jims用户已在gaim中登录,则会显示“hello jims”的信息。如果在gaim中发一条叫“hello test,this m essage form gaim.”给test@debian,则会在telnet里收到如下格式的信息:<message type='chat' to='test@debian/telnet' from='yangjing@debian/Gaim'><x xmlns='jabber:x:event'><composing/></x><body>hello test,this message form gaim.</body><html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>hello test,this message form gaim.</body></html></message> 用以下命令可退出会话:</stream:stream> 从上面的信息可以看到,在jabber传送的信息流是XML格式的。这为jabber服务的扩展提供了很好的发展空间。 10.13. 安装Jabberd2服务器 jabberd2服务器还没正式进入Debian的软件包,但我们可从源码开始安装。下面介绍如何在Debian平台中如何从源码安装jabberd-2.0s10。这里的2.0s10表示jabberd2.0的第十个stable发行版。 到jabberd的官方网站下载最新的软件包jabberd-2.0s10.tar.gz。用tar -zxvf jabberd-2.0s10.tar.gz命令解压后会在当前目录下生成jabberd-2.0s10目录。 进入源码目录,我们就可以用configure工具配置软件包。但在配置前,先要安装一些支持软件包,分别是libssl-dev和libidn11-dev,还有libmysqlclient14-dev,该软件包用于支持Mysql数据库作为后台数据存储和用户验证,如果你想通过ldap目录服务器来进行用户认证,则还需安装libldap2-dev软件包。准备好后,运行以下命令配置jabberd2:debian:~/inst/jabberd-2.0s10# ./configure --prefix=/usr/local/jabberd2 --enable-ldap --enable-debug 配置成功后,运行make和make install即可把软件安装到/usr/local/jabberd2目录中。 现在可以配置服务器了,jabberd2的配置文件位于/usr/local/jabberd2/etc/jabberd目录下,配置文件的文本是XML格式的。现在我们要修改sm.xml和c2s.xml这两个配置文件,把真实的服务器名写到这两个配置文件中:修改sm.xml文件,把id标签内的localhost改成真实服务器名<!-- Session manager configuration --><sm> <!-- Our ID on the network. Users will have this as the domain part of their JID. If you want your server to be accessible from other Jabber servers, this ID must be resolvable by DNS.s (default: localhost) --> <id>localhost</id>...修改c2s.xml文件,也是把id标签内的localhost改成真实服务器名... <!-- Local network configuration --> <local> <!-- Who we identify ourselves as. This should correspond to the ID (host) that the session manager thinks it is. You can specify more than one to support virtual hosts, as long as you have additional session manager instances on the network to handle those hosts. The realm attribute specifies the auth/reg or SASL authentication realm for the host. If the attribute is not specified, the realm will be selected by the SASL mechanism, or will be the same as the ID itself. Be aware that users are assigned to a realm, not a host, so two hosts in the same realm will have the same users. If no realm is specified, it will be set to be the same as the ID. --> <id>localhost</id>... jabberd2默认使用MySQL来存放数据和进行用户认证。所以我们还要配置MySQL数据库,为jabberd2增加相应的数据库和表。jabberd2软件包已为我们提供了一个MySQL脚本自动完成数据库和表的创建。这个脚本位于源码目录下的tools目录中,文件名是db-setup.mysql。该目录还有针对不同数据库(Oracle、PostgreSQL)的脚本可用。我们以管理员身份登录MySQL服务器,用以下命令运行db-setup.mysql脚本。在运行脚本前,请确保该脚本在当前目录下。debian:~/inst/jabberd-2.0s10/tools# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 68 to server version: 4.0.24_Debian-10sarge1-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> \. db-setup.mysqlQuery OK, 1 row affected (0.00 sec)Database changedQuery OK, 0 rows affected (0.13 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.02 sec)... 创建完数据库和表后,我们还要配置该数据库的访问权限,很简单,运行以下命令即可:mysql> grant select,insert,delete,update on jabberd2.* to jabberd2@localhost identified by '123456';Query OK, 0 rows affected (0.00 sec) 现在我们就在MySQL数据库创建一个jabberd2用户,密码是123456。该用户可以在jabberd2数据库中做select,insert,delete,update操作。为了使jabberd2服务器能登录该数据库,我们还需用"jabberd2"和"123456"这两个参数更新sm.xml和c2s.xml两个配置文件的相关内容。修改sm.xml文件...<!-- Storage database configuration --> <storage> <!-- By default, we use the MySQL driver for all storage --> <driver>mysql</driver> <!-- Its also possible to explicitly list alternate drivers for specific data types. --> <!-- Store vcards in a PostgreSQL database instead --> <!-- <driver type='vcard'>pgsql</driver> --> <!-- MySQL driver configuration --> <mysql> <!-- Database server host and port --> <host>localhost</host> <port>3306</port> <!-- Database name --> <dbname>jabberd2</dbname> <!-- Database username and password --> <user>jabberd2</user> <pass>123456</pass>...修改c2s.xml... <!-- MySQL module configuration --> <mysql> <!-- Database server host and port --> <host>localhost</host> <port>3306</port> <!-- Database name --> <dbname>jabberd2</dbname> <!-- Database username and password --> <user>jabberd2</user> <pass>123456</pass> </mysql>... 最后一步,根据sm.xml或c2s.xml中pidfile标签的内容创建进程ID目录。在我的机器上sm.xml配置文件中pidfile标签的内容如下: <pidfile>/usr/local/jabberd2/var/jabberd/pid/sm.pid</pidfile> 创建pid目录的命令如下:debian:/usr/local/jabberd2# mkdir -p var/jabberd/pid/ 是否创建该目录对服务器的正常运行没有影响,只是有了该目录后,当服务器运行时,在该目录下会生成jabberd2服务进程Id文件,我们可跟踪jabberd2服务器的进程Id号。 启动服务器debian:/usr/local/jabberd2/bin# ./jabberd 如果启动不成功,可查询系统日志或用-D选项启动服务器。 服务器启动后,我们就可用Gaim等客户端连接它。具体操作和上一节内容一样,这里就不再讲了。 除了上面介绍的使用MySQL数据库作为用户认证数据库外,我们还可使用LDAP目录服务进行用户认证。下面介绍具体的配置过程,我选用的LDAP服务器是OpenLDAP,版本号是2.2.23-8。 要使jabberd2使用LDAP目录服务,需在源码配置时加--enable-ldap选项,并安装libldap2-dev软件包。 配置c2s.xml文件以支持ldap认证:... <!-- Authentication/registration database configuration --> <authreg> <!-- Backend module to use --> <module>ldap</module> #启用ldap认证模块,默认是MySQL <!-- Registration configuration --> <register> <!-- Account registration is enabled by default (provided the auth/reg module in use supports it). Comment this out to disable. --> <!-- <enable/> --> #注释该行,禁止用户自由注册,启用ldap认证后,该功能失效。jabberd2暂时还不支持在LDAP服务器上创建用户信息。...<!-- LDAP module configuration --> #开始配置LDAP服务参数 <ldap> <!-- LDAP server host and port (default: 389) --> <host>Ldap_server</host> #配置LDAP服务器主机名 <port>389</port> #配置LDAP服务器端口 <!-- Use LDAP v3 if possible. If disabled, v2 will be used. Encryption options are only available if v3 is enabled. --> <!-- <v3/> --> <!-- Encryption. If enabled, this will create an encrypted channel to the LDAP server using the LDAP STARTTLS mechanism. --> <!-- <starttls/> --> <!-- Encryption. If enabled, this will create an encrypted channel to the server using the old-style "ldaps://" mechanism. It is recommended that you use <starttls/> instead of this. --> <!-- <ssl/> --> <!-- DN to bind as for searches. If unspecified, the searches will be done anonymously. --> <binddn>cn=admin,dc=com</binddn> #配置登录LDAP服务器的DN <bindpw>123456</bindpw> #配置登录密码 <!-- LDAP attribute that holds the user ID (default: uid) --> <uidattr>uid</uidattr> #配置用户认证属性 <!-- base DN of the tree. You should specify a DN for each authentication realm declared in the <local/> section above, by using the realm attribute. --> <basedn realm=''>dc=user,dc=company,dc=com</basedn> #配置搜索路径起点 <!-- <basedn>o=Example Corp.</basedn> --> </ldap>... 配置sm.xml文件,启用auto-create功能,自动始初化会话。... <!-- User options --> <user> <!-- By default, users must explicitly created before they can start a session. The creation process is usually triggered by a c2s component in response to a client registering a new user. Enableing this option will make it so that a user create will be triggered the first time a non-existant user attempts to start a session. This is useful if you already have users in an external authentication database (eg LDAP) and you don't want them to have to register. --> <auto-create/> #该功能只在禁用公开注册,采用外部验证数据库时启用,开启该功能后,当用户第一次登录时,jabberd2会自动把用户信息插入到active表。#如果开启公开注册功能,则应该禁用该功能,用户信息会在注册时自动插入到active表。... 配置完成后,重启Jabberd2服务器,如果配置正确,可在系统日志/var/log/message文件看到以下信息:...Nov 24 11:33:17 t03 jabberd/sm[29600]: initialised storage driver 'mysql' #成功连接MySQL数据库Nov 24 11:33:17 t03 jabberd/sm[29600]: version: jabberd sm 2.0s10...Nov 24 11:33:17 t03 jabberd/c2s[29602]: starting upNov 24 11:33:17 t03 jabberd/c2s[29602]: process id is 29602, written to /usr/local/jabberd2/var/jabberd/pid/c2s.pidNov 24 11:33:17 t03 jabberd/c2s[29602]: ldap: configured 1 realmsNov 24 11:33:17 t03 jabberd/c2s[29602]: initialised auth module 'ldap' #成功连接LDAP服务器Nov 24 11:33:17 t03 jabberd/c2s[29602]: [t03.tigerhead] configured; realm=(null) 在jabberd2中,我们可以设置默认的好友列表模板,当用户第一次登录系统时就会自动获得该列表,不用手动一个用户一个用户地添加。要启用该功能,首先要在sm.xml配置文件的内进行配置。jabberd2默认是没有打开该功能的,我们只要在sm.xml文件中把template内的roster标签前的注释符删除即可。如:... <!-- Templates. If defined, the contents of these files will be stored in the users data store when they are created. --> <template> <roster>/usr/local/jabberd2/etc/jabberd/templates/roster.xml</roster> </template>... 从上面的配置可以看以,默认的模块是存放在/usr/local/jabberd2/etc/jabberd/templates/roster.xml目录下的。我们编辑roster.xml文件,按以下格式添加用户列表。<!-- This is the roster template. If enabled in sm.xml, new users will get this roster by default. --><query xmlns='jabber:iq:roster'> <!-- <item name='Helpdesk' jid='helpdesk@localhost' subscription='both'><group>Support</group></item> --> <item name='ringkee' jid='ringkee@company.com' subscription='both'><group>IT</group></item> <item name='diu167' jid='diu167@company.com' subscription='both'><group>IT</group></item> <item name='dongrui' jid='dongrui@company.com' subscription='both'><group>IT</group></item> <item name='sally' jid='sally@company.com' subscription='both'><group>IT</group></item> <item name='xmr' jid='xmr@company.com' subscription='both'><group>IT</group></item></query> 上面设置了一个IT组,里面有5个用户。修改roster.xml文件后,不用重启服务器就可使修改生效。当用户首次登录时,这5个用户列表会自动下载到客户端。这种下载动作只会在用户首次登录系统时发生。当用户第一次登录时,jabberd2会在active表中插入一条记录,记录登录的用户帐号名和登录时间等信息。jabberd2以此判断用户是否第一次登录。同时把模板中的用户列表信息按登录用户的不同保存在roster-items和roster-groups两个表中。当用户第二次登录时,jabberd2在active中可以查询到用户帐号信息,就不会再把模板中的用户列表信息保存到roster-items和roster-groups表中。而是直接下载roster-items和roster-groups表中的用户列表信息来使用。当用户在客户端手工删除用户列表后,jabberd2会直接删除roster-items和roster-groups表中的用户列表信息。这样,下次用户登录时就找不到用户列表了,所以我们不要随便删除用户列表信息。为了使删除后的用户列表能重新下载或更新,我们可在active表中删除该用户的帐号记录。下次用户登录系统时,系统还会把你当成是首次登录,又会自动下载模板中的用户列表。 jabberd2系统的所有信息都保存在MySQL数据库的jabberd2数据库中。一面介绍jabberd2数据库各个表的作用。 active表,存放用户名和用户第一次登录的时间。表中的记录在用户第一次登录系统时插入,以后用户登录系统不影响该记录的内容。 authreg表,当选择MySQL数据库作为jabberd2的用户验证数据库时,该 表才有意义。它用以存放用户的验证信息,如用户名、密码和范围。 disco-items表,记录离线信息。 logout表,记录用户最近的登出信息,包括jid和时间戳。 motd-message表,记录XML格式的MOTD(Message Of The Day)信息。 motd-message表,记录接收的MOTD信息内容,包括jid和时间戳。 privacy-default表, privacy-items表, private表,以XML格式存放用户的私人信息,如收藏夹、爱好等。 queue表,存放排序信息。 roster-groups表,保存已分组的用户列表信息。 roster-items表,保存用户列表信息,包含验证状态信息。 vacation-setting表, vcard表,保存用户帐号信息,包含用户名、住址、URL和职务等。 jabberd2服务器由一系列的进程组成,各进程互相依赖。如果要手动杀死jabberd2进程,则要按一定的顺序。如:#!/bin/bashkillall routerkillall resolverkillall c2skillall s2skillall sm 由于Jabber协议的开放性,造就了众多的开源的Jabber客户端,在http://www.jabber.org上有一个Jabber Client软件的列表可供参考。我试过几种,从功能和中文支持上推荐Psi和Gaim两种。还有一个基于Web的Jabber客户端jwchat,它利用punjab这个HTTP jabber client接口和Ajax技术,可在浏览器上登录jabber服务器进行即时通信。jwchat网站上有一个Demo,大家可以去看看,很不错的。但我没安装成功,有谁成功安装,请指点一二。 10.14. MoinMoin服务器 MoinMoin是用Python语言写的一个开源WiKi服务器,由德国人开发,基于GNU GPL协议发布。MoinMoin的软件架构很灵活,通过Python能很容易进行功能扩展,现在已开发出大量的Plugins。MoinMoin不使用后台数据库存放数据,而是以文本的形式存放在服务器目录中。debin Wiki网站使用的WiKi系统就是MoinMoin。Moin是德国北部方言"好"、"早上好"的意思,MoinMoin是"很好"的意思。 10.14.1. 安装配置 MoinMoin不带Web服务器,需与Web服务器配合才能进行WiKi页面的发布。MoinMoin支持的Web服务器有Apache+CGI、Apache+FastCgi、Apache+Mod_Python、IIS、TwistedWeb和WebLogic等。下面介绍一下MoinMoin+TwistedWeb和Apache2+Mod_Python两种方式在Debian系统下的安装过程。 在安装MoinMoin前请安装好Python,最好使用最新的版本。安装MoinMoin的命令如下:debian:~# apt-get install python2.4-moinmoin moinmoin-common 500)this.width=500'> 安装软件包时要注意版本问题,2.3的包不能和2.4的包混用。 MoinMoin的源码被安装到/usr/lib/python2.4/site-packages/MoinMoin目录。/usr/share/moin目录存放MoinMoin系统的模板,内容大致有以下几类: /usr/share/moin/data目录存放WiKi Pages,Users,etc。只能被MoinMoin访问。 /usr/share/moin/underlay目录存放默认的WiKi Pages,有多种语言版本的帮助文档、默认页面文档等。只能被MoinMoin访问。 /usr/share/moin/htdocs目录存放网页元素,如图片、主题风格等。可被Web Server访问 /usr/share/moin/server目录存放服务器启动脚本示例。 /usr/share/moin/config目录存放配置文件示例。 通过拷贝模板目录中的文件,就可生成不同的WiKi实例。MoinMoin的软件升级也很简单,只需用新版的模板文件下覆盖旧文就可以了。 创建MoinMoin实例 在服务器上创建一个目录用于存放实例,目录名不能是wiki,它已被系统保留使用,一个不错的选择是mywiki。debian:~# mkdir mywiki 从模板目录拷贝实例所需文件。debian:~# cp -rf /usr/share/moin/data ~/mywikidebian:~# cp -rf /usr/share/moin/underlay ~/mywikidebian:~# cp /usr/share/moin/config/wikiconfig.py ~/mywiki 设置实例目录权限 Debian中的MoinMoin系统默认使用www-data用户运行WiKi服务器。所以我们的权限设置是:debian:~# chown -R www-data.www-data ~/mywikidebian:~# chmod -R ug+rw ~/mywikidebian:~# chmod -R o-rwx ~/mywiki 配置TwistedWeb方式,这里介绍的MoinMoin版本是1.3.1的。 首先,我们要安装好twisted,安装命令如下:debian:~# apt-get install python2.4-twisted python2.4-twisted-bin 安装完Twisted后,就可以开始配置了。TwistedWeb的MoinMoin配置文件是mointwisted.py,执行文件是mointwisted,这两个文件我们可从模板目录拷贝到实例目录。如:debian:~# cp /usr/share/moin/server/mointwisted mointwisted.py ~/mywiki 用vim等文本编辑器打开mointwisted.py配置文件,需修改两个地方,以指向正确的配置文件路径,修改后的内容如下:""" twisted.web based wiki server Run this server with mointwisted script on Linux or Mac OS X, or mointwisted.cmd on Windows. @copyright: 2004-2005 Thomas Waldmann, Oliver Graf, Nir Soffer @license: GNU GPL, see COPYING for details."""# System path configurationimport sys# Path of the directory where wikiconfig.py is located.# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.#sys.path.insert(0, '/etc/moin')sys.path.insert(0,'/root/mywiki') #修改1:指向你的wikiconfig.py文件所在的目录# Path to MoinMoin package, needed if you installed with --prefix=PREFIX# or if you did not use setup.py# Path to the directory where farmconfig is located (if different).#sys.path.insert(0, '/etc/moin') #修改2:注释掉该行内容,从1.5版开始已默认注释该行# Debug mode - show detailed error reports## import os## os.environ['MOIN_DEBUG'] = '1'from MoinMoin.server.twistedmoin import TwistedConfig, makeApp class Config(TwistedConfig): # Server name # Used to create .log, .pid and .prof files name = 'mointwisted' # Path to moin shared files (default '/usr/share/moin/wiki/htdocs') docs = '/usr/share/moin/htdocs' # The server will run with as this user and group (default 'www-data') user = 'www-data' group = 'www-data' # Port (default 8080) # To serve privileged port under 1024 you will have to run as root port = 8080 # Interfaces (default ['']) # The interfaces the server will listen to. # [''] - listen to all interfaces defined on the server # ['red.wikicolors.org', 'blue.wikicolors.org'] - listen to some # If '' is in the list, other ignored. interfaces = [''] # How many threads to use (default 10, max 20) # The more threads you use, the more memory moin uses. All thread # use one CPU, and will not run faster, but might be more responsive # on a very busy server. threads = 10 # Set logfile name (default commented) # This is the *Apache compatible* log file, not the twisted-style logfile. # Leaving this as None will have no Apache compatible log file. Apache # compatible logfiles are useful because there are quite a few programs # which analyze them and display statistics. ## logPath = 'mointwisted.log' # Memory profile (default commented) # Useful only if you are a developer or interested in moin memory usage ## from MoinMoin.util.profile import TwistedProfiler ## memoryProfile = TwistedProfiler('mointwisted', ## requestsPerSample=100, ## collect=0) # Hotshot profile (default commented) # Not compatible with threads. ## hotshotProfile = name + '.prof'# Create the applicationapplication = makeApp(Config) 配置MoinMoin Wiki系统 Single Wiki的配置文件是wikiconfig.py,位于实例目录下,它默认已可很好工作。它的内容如下:# -*- coding: utf-8 -*- #为了在MoinMoin中使用中文,请用utf-8编码# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a# western country and you don't know that you use utf-8, you probably want to# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode# encoding) you MUST use: coding: utf-8# That setting must match the encoding your editor uses when you modify the# settings below. If it does not, special non-ASCII chars will be wrong. """ 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.multiconfig for a full list of names and their default values. Also, the URL http://moinmoin.wikiwikiweb.de/HelpOnConfiguration has a list of config options. @copyright: 2000-2005 by Juergen Hermann <jh@web.de> @license: GNU GPL, see COPYING for details.""" from MoinMoin.multiconfig import DefaultConfig class Config(DefaultConfig): # Wiki identity ---------------------------------------------------- # Site name, used by default for wiki name-logo [Unicode] sitename = u'Untitled Wiki' #你的WiKi网站的名称 # Wiki logo. You can use an image, text or both. [Unicode] # Example: u'<img src="/wiki/mywiki.png" alt="My Wiki">My Wiki' # For no logo or text, use '' logo_string = sitename #WiKi的logo # The interwiki name used in interwiki links interwikiname = None # Critical setup --------------------------------------------------- # Misconfiguration here will render your wiki unusable. Check that # all directories are accessible by the web server or moin server. # If you encounter problems, try to set data_dir and data_underlay_dir # to absolute paths. # Where your mutable wiki pages are. You want to make regular # backups of this directory. data_dir = './data/' # Where read-only system and help page are. You might want to share # this directory between several wikis. When you update MoinMoin, # you can safely replace the underlay directory with a new one. This # directory is part of MoinMoin distribution, you don't have to # backup it. data_underlay_dir = './underlay/' # This must be '/wiki' for twisted and standalone. For CGI, it should # match your Apache Alias setting. url_prefix = '/wiki' # Security ---------------------------------------------------------- # Security critical actions (disabled by default) # Uncomment to enable options you like. allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage'] #允许删除、上传和改名操作,操作受ACL约束。 # Enable acl (0 to disable) acl_enabled = 1 #开启ACL(访问控制列表)功能 # 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" #替换YourName,该用户具有管理员权限。 # Link spam protection for public wikis (Uncomment to enable) # Needs a reliable internet connection. #from MoinMoin.util.antispam import SecurityPolicy # Mail -------------------------------------------------------------- # Configure to enable subscribing to pages (disabled by default) # or sending forgotten passwords. # SMTP server, e.g. "mail.provider.com" (empty or None to disable mail) mail_smarthost = "" # The return address, e.g "My Wiki <noreply@mywiki.org>" mail_from = "" # "user pwd" if you need to use SMTP AUTH mail_login = "" # User interface ---------------------------------------------------- # Add your wikis important pages at the end. It is not recommended to # remove the default links. Leave room for user links - don't use # more than 6 short items. # You MUST use Unicode strings here, but you need not use localized # page names for system and help pages, those will be used automatically # according to the user selected language. [Unicode] navi_bar = [ #FrontPage中的导航栏,可根据自已需求增减。 # Will use page_front_page, (default FrontPage) u'%(page_front_page)s', u'RecentChanges', u'FindPage', u'HelpContents', ] # The default theme anonymous or new users get theme_default = 'modern' #默认的页面风格 # Language options -------------------------------------------------- # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in # YOUR language that other people contributed. # The main wiki language, set the direction of the wiki pages default_lang = 'zh' #默认语言 # You must use Unicode strings here [Unicode] #页面默认正则式, page_category_regex = u'^Category[A-Z]' #以Category字符串开头的页面是分类页面 page_dict_regex = u'[a-z]Dict$' #以Dict字符串结束的页面是字典页面 page_form_regex = u'[a-z]Form$' #以Form字符串结尾的页同是表单页面 page_group_regex = u'[a-z]Group$' #以Group字符串结尾的页面是组页面 page_template_regex = u'[a-z]Template$' #以Template字符串结尾的页同是模板页面 # Content options --------------------------------------------------- # Show users hostnames in RecentChanges show_hosts = 1 # Enumerate headlines? show_section_numbers = 0 # Charts size, require gdchart (Set to None to disable). chart_options = {'width': 600, 'height': 300} 完整的配置选项可在MoinMoin/multiconfig.py文件找到,wikiconfig.py中的配置就是继承它的。multiconfig.py文件里的选项是默认配置,不要去修改它。如果我们要修改这些默认配置,可在wikiconfig.py中重新设置它即可。 multiconfig.py中一些默认权限配置选项说明: acl_enabled = 1选项配置是否记用ACL,1表示启用,0表示不启用。 acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"选项设置了默认的WiKi页面权限。当WiKi页面没有设置ACL是,就统一采用该设置。 acl_rights_before = u""选项中的权限设置优先级高于WiKi页面中ACL的设置和上面的默认ACL设置。所以一般在该选项中配置我们MoinMoin系统的管理员。该选项默认在multiconfig.py文件中没有设置。我们要在MoinMoin实例中的wikiconfig.py文件中设置,具体设置请见上同的wikiconfig.py示例。 acl_rights_after = u""选项中的权限设置优先级低于WiKi页面中ACL的设置和上面的默认ACL设置。 acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin']选项列出了可以设置权限。 allowed_actions = []选项设置允许的系统定义操作。这些操作有删除页面、页面改名和上传附件等。这些操作的访问权限也会页面的ACL约束。 attachments = None选项设置可通过浏览器直接访问附件。如果要设置该选项,请确保上传到Web服务器上的附件不能被执行。设置方法可参考http://moinmoin.wikiwikiweb.de/HelpOnConfiguration/FileAttachments的内容。 启动MoinMoin WiKi服务器debian:~/mywiki# ./mointwisted start 在当前目录会生成一个叫twistd.log的日志文件。如果成功启动,日志文件的内容为:2005/12/13 11:48 CST [-] Log opened.2005/12/13 11:48 CST [-] twistd 2.0.1 (/usr/bin/python2.4 2.4.2) starting up2005/12/13 11:48 CST [-] reactor class: twisted.internet.selectreactor.SelectReactor2005/12/13 11:48 CST [-] Loading mointwisted.py...2005/12/13 11:48 CST [-] Enabling Multithreading.2005/12/13 11:48 CST [-] Loaded.2005/12/13 11:48 CST [-] MoinMoin.server.twistedmoin.MoinSite starting on 80802005/12/13 11:48 CST [-] Starting factory <MoinMoin.server.twistedmoin.MoinSite instance at 0xb76004cc>2005/12/13 11:48 CST [-] set uid/gid 33/33 MoinMoin成功启动后,在浏览器上打开http://server_name:8080网址即可访问。停止服务器用stop参数即可。用不带参数的mointwisted命令可以查看命令参数,如:debian:~/mywiki# ./mointwisted error: nothing to domointwisted - MoinMoin daemonusage: mointwisted commandcommands: start start the server stop stop the server restart stop then start the server kill kill the server@copyright: 2004-2005 Thomas Waldmann, Nir Soffer@license: GNU GPL, see COPYING for details. Apache2+Mod_Python方式,这里我选用了最新的1.5版的MoinMoin软件包。 第一步要先安装Mod_Python模块,要求使用mod_python 3.1.3或以上版本的Mod_Python模块。安装命令如下:debian:~# apt-get install libapache2-mod-python2.3 下载完软件包后Debian系统会自动进行软件包的配置,回答"Yes"启用Mod_Python模块。这样在/etc/apache2/mods-enabled目录下会创建一个链接到/etc/apache2/mods-available/mod_python.load文件。该文件配置了装载mod_python模块的语句,如:LoadModule python_module /usr/lib/apache2/modules/mod_python.so 第二步是创建WiKi实例,步骤同上。 第三步是配置wikiconfig.py,内容如下:# -*- coding: utf-8 -*- #使用UTF-8编码# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a# western country and you don't know that you use utf-8, you probably want to# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode# encoding) you MUST use: coding: utf-8# That setting must match the encoding your editor uses when you modify the# settings below. If it does not, special non-ASCII chars will be wrong.""" 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.multiconfig for a full list of names and their default values. Also, the URL http://moinmoin.wikiwikiweb.de/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! ** @copyright: 2000-2005 by Juergen Hermann <jh@web.de> @license: GNU GPL, see COPYING for details."""from MoinMoin.multiconfig import DefaultConfigclass Config(DefaultConfig): # Wiki identity ---------------------------------------------------- # Site name, used by default for wiki name-logo [Unicode] sitename = u'Untitled Wiki' #你的WiKi网站的名称 # Wiki logo. You can use an image, text or both. [Unicode] # For no logo or text, use '' - the default is to show the sitename. # See also url_prefix setting below! logo_string = u'<img src="/wiki/common/moinmoin.png" alt="MoinMoin Logo">' #网站Logo # name of entry page / front page [Unicode], choose one of those: # a) if most wiki content is in a single language #page_front_page = u"MyStartingPage" # b) if wiki content is maintained in many languages page_front_page = u"FrontPage" #启用首页 # The interwiki name used in interwiki links #interwikiname = 'UntitledWiki' # Show the interwiki name (and link it to page_front_page) in the Theme, # nice for farm setups or when your logo does not show the wiki's name. #show_interwiki = 1 # Critical setup --------------------------------------------------- # Misconfiguration here will render your wiki unusable. Check that # all directories are accessible by the web server or moin server. # If you encounter problems, try to set data_dir and data_underlay_dir # to absolute paths. # Where your mutable wiki pages are. You want to make regular # backups of this directory. data_dir = '/root/mywiki/data/' #设置data目录路径,要用绝对路径 # Where read-only system and help page are. You might want to share # this directory between several wikis. When you update MoinMoin, # you can safely replace the underlay directory with a new one. This # directory is part of MoinMoin distribution, you don't have to # backup it. data_underlay_dir = '/root/mywiki/underlay/' #设置underlay目录路径,要用绝对路径 # This must be '/wiki' for twisted and standalone. For CGI, it should # match your Apache Alias setting. url_prefix = '/wiki' # Security ---------------------------------------------------------- # This is checked by some rather critical and potentially harmful actions, # like despam or PackageInstaller action: superuser = [u"moin_admin", ] #设置超级用户,1.5版新增选项 # 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" #设置管理权限 # Link spam protection for public wikis (Uncomment to enable) # Needs a reliable internet connection. #from MoinMoin.util.antispam import SecurityPolicy # Mail -------------------------------------------------------------- # Configure to enable subscribing to pages (disabled by default) # or sending forgotten passwords. # SMTP server, e.g. "mail.provider.com" (None to disable mail) mail_smarthost = "smtp.21cn.com" #使用21cn的smtp服务器发送邮件 # The return address, e.g u"Jürgen Wiki <noreply@mywiki.org>" [Unicode] mail_from = u"yjnet<yjnet@21cn.com>" #发送者 # "user pwd" if you need to use SMTP AUTH mail_login = "yjnet 123456" #SMTP服务器验证,以"user password"格式填写 # User interface ---------------------------------------------------- # Add your wikis important pages at the end. It is not recommended to # remove the default links. Leave room for user links - don't use # more than 6 short items. # You MUST use Unicode strings here, but you need not use localized # page names for system and help pages, those will be used automatically # according to the user selected language. [Unicode] navi_bar = [ #设置导航栏 # If you want to show your page_front_page here: u'%(page_front_page)s', u'RecentChanges', u'FindPage', u'HelpContents', ] # The default theme anonymous or new users get theme_default = 'modern' #设置网页主题峁 # Language options -------------------------------------------------- # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in # YOUR language that other people contributed. # The main wiki language, set the direction of the wiki pages language_default = 'zh' #设置默认语言 # You must use Unicode strings here [Unicode] page_category_regex = u'^Category[A-Z]' page_dict_regex = u'[a-z]Dict$' page_form_regex = u'[a-z]Form$' page_group_regex = u'[a-z]Group$' page_template_regex = u'[a-z]Template$' # Content options --------------------------------------------------- # Show users hostnames in RecentChanges show_hosts = 1 # Enable graphical charts, requires gdchart. #chart_options = {'width': 600, 'height': 300} 第四步是配置在Apache2中配置Mod_Python,在/etc/apache2/conf目录下创建一个moin_mop_python.conf的配置文档,内容如下:Alias /wiki/ "/usr/share/moin/htdocs/" <Location /mywiki> SetHandler python-program# Add the path of your wiki directory PythonPath "['/root/mywiki/'] + sys.path" PythonHandler MoinMoin.request::RequestModPy.run</Location> 如果要Apache同时处理两个Wiki实例,除要按上面介绍的方法创建实例目录外,还需在每个Location中添加PythonInterpreter,指定Python解析器的名称空间。如:Alias /wiki/ "/usr/share/moin/htdocs/"<Location /mywiki> SetHandler python-program PythonInterpreter mywiki # 指定名称空间为mywiki# Add the path of your wiki directory PythonPath "['/root/mywiki/'] + sys.path" PythonHandler MoinMoin.request::RequestModPy.run</Location><Location /secondwiki> SetHandler python-program PythonInterpreter secondwiki # 指定名称空间为secondwiki# Add the path of your wiki directory PythonPath "['/root/secondwiki/'] + sys.path" # /root/secondwiki是另外一个wiki实例的目录 PythonHandler MoinMoin.request::RequestModPy.run</Location> 配置完成后,需重启Apache服务器,查询Apache日志可看到服务器的启动状态,Apache的日志存放在/var/log/apache2目录下。成功启动后,访问http://moinserver/mywiki即可打开进入MoinMoin,访问http://moinserver/secondwiki就可访问另一个MoinMoin。 最后,我们还要安装中文语言包。我们先要在MoinMoin中用登录界面创建一个有管理员权限的用户,在该例中就是moin_admin用户。以该用户登录后再访问http://moinserver/mywiki/SystemPagesSetup网页安装中文语言包。如果你没有管理权限,访问该页面时在语言包前面是不会显示"安装"按钮的。 从moin1.5.1升级到moin1.5.3的操作很简单,首先备份好/usr/lib/python2.3/site-packages/MoinMoin目录和/usr/share/moin目录。接着删除这两个目录和实例目录下的underlay目录,安装新版本的moinmoin系统。最后把/usr/share/moin/underlay目录拷贝到实例目录,修改该目录的访问权限。升级完成要重启服务器。注意,如果你修改了/usr/lib/python2.3/site-packages/MoinMoin目录和/usr/share/moin目录下文件的内容,升级完成后要重新修改或用旧文件覆盖。 10.14.2. 访问控制列表(ACL) 语法:#acl [+-]User[,SomeGroup,...]:[right[,right,...]] [[+-]OtherUser:...] [[+-]Trusted:...] [[+-]Known:...] [[+-]All:...] [Default]参数说明:User 用户名SomeGroup 组名Trusted 一个特殊组,包括所有通过HTTP-Basic-authentication验证的用户Known 一个特殊组,包括所有有效用户 (使用 cookie 验证方法)All 一个特殊组,包括所有用户 Default 一个特殊项,使用配置文件中acl_rights_default中的值right 表示权限,可以是 read、write、delete、revert 和 admin的组合,允许为空,表示没有任何权限。权限说明:read 读权限write 编辑权限delete 删除页面和附件的权限revert 有还原旧版本的权限admin 具有管理ACL的权限 ACL放在网页内容的前面,下面一个ACL示例,所有用户有浏览权限,moin_admin用户具有所有权限:#acl moin_admin:read,write,delete,revert,admin All:read这是网页正文。MoinMoin ACL示例。... MoinMoin按ACL设置的顺序匹配用户,一旦匹配就不会搜索后面的配置。如上例,当我以moin_admin用户登录后访问该网页,它匹配了第一个用户名,则MoinMoin的ACL执行过程就停止,不会去再去匹配后面的ACL。所以我们在设置ACL时,应按用户、特殊组、普通组、Known、All的顺序设置。 在MoinMoin中,组是用网页来维护的,在配置文件中的page_group_regex = u'[a-z]Group$'选项规定,以任意的小写字母组合后接Group结尾命名的页面都是一个组,如:testGroup,网页内每个最高列表项代表一个组成员,下例设置了test1,test2,test3三个用户。:#acl moin_admin:read,write,delete,revert,admin All:read *test1 *test2 *test3... 在ACL设置中,MoinMoin引入"+"号和"-"号,改变ACL的配置规则,使ACL配置更灵活。当用户请求一个具有"+"或"-"号的ACL的页面时,只在用户名和权限同时匹配时才动作,"+"表示授予权限用户权限,"-"号表示禁止用户的权限,并停止ACL匹配。如果用户名和权限有一个不匹配,则继续搜索下一个ACL项。下面有一个示例:#acl SomeUser:read,write SomeGroup:read,write,admin All:read可以写成:#acl -SomeUser:admin SomeGroup:read,write,admin All:read或#acl +All:read -SomeUser:admin SomeGroup:read,write,admin wikiconfig.py配置文档中可以设置系统级的ACL,它将影响系统中的所有页面。系统级ACL分别通过acl_rights_default,acl_rights_before和acl_rights_after这三个配置参数来设置。acl_rights_default控制系统默认的ACL,当文档中没有设置ACL时就按acl_rights_default的配置设置文档的ACL;acl_rights_before的ACL在文档的ACL之前执行,也就是说在acl_rights_before里设置的ACL的优先级高于文档的ACL,一般在这里设置系统管理员的ACL。acl_rights_after的ACL是对文档ACL的补充,优先级低于文档中的ACL。 10.14.3. 用户验证 使用Apache basic auth进行用户验证 MoinMoin的用户信息存放在instance/data/user目录下,每个用户都有一个类似1137395855.97.12542的文件,里面记录着用户名、密码和显示样式等信息,MoinMion利用这些信息来进行用户验证和权限的控制。MoinMoin默认是使用Cookis来验证用户的,从1.3版开始,我们也可使用基于HTTP的用户验证,也就是说可以使用其它的用户数据库,如LDAP。不论使用Cookis还是HTTP方式,user目录下一定要存在一个与之对应的用户文件。因为MoinMoin只会使用该用户文件中的信息进行权限控制,所以在MoinMoin的配置文件中有一个user_autocreate参数,当把该选项设置为真时,当第一次用Apache basic auth方式登录MoinMion时,系统会自动在user目录下创建一个用户文件,该用户文件里不保存用户密码,只保存用户名和个人定制配置信息。采用HTTP验证方式,要修改两个文件,一个是wikiconfig.py,一个是moin_mod_python.conf。 wikiconfig.py文件中修改的内容如下:...from MoinMoin.auth import http...class Config(DefaultConfig):... user_autocreate=1 auth=[http]... 修改后的moin_mod_python.conf:Alias /wiki/ "/usr/share/moin/htdocs/"<Location /portal> AuthType Basic AuthName "Portal" AuthUserFile "/etc/apache2/moinmoin.passwd" Require valid-user SetHandler python-program# Add the path of your wiki directory PythonPath "['/data/moin/portal/'] + sys.path" PythonHandler MoinMoin.request::RequestModPy.run</Location> moinmoin.passwd用户文件可用htpasswd2文件创建。需重启Apache服务器使配置生效。 使用Apache+LDAP进行用户验证 原理同上,只是验证数据我们存放在LDAP目录数据库。我使用OpenLDAP做为LDAP服务器。因为Apache+LDAP方式也是通过MoinMoin的HTTP验证模块进行的,所以wikiconfig.py的配置同上面的是一样的。这里的关健是要配置好Apache与LDAP服务器的连接。Apache需安装有mod_ldap.so和auth_ldap.so模块,如果已安装,可在/usr/lib/apache2/modules目录下查询到。在Debian中这两个模块默认是不启动的,可在/etc/apache2/mods-enable目录下创建一个auth_ldap.load链接来启动它,如:debian:/etc/apache2/mods-enabled# ln -s /etc/apache2/mods-available/auth_ldap.load auth_ldap.load auth_ldap.load文件会装载mod_ldap.so和auth_ldap.so这两个模块。下面配置moin_mod_python.conf,修改后的内容如下:Alias /wiki/ "/usr/share/moin/htdocs/"#LDAP连接Cache参数LDAPSharedCacheSize 200000LDAPCacheEntries 1024LDAPCacheTTL 600LDAPOpCacheEntries 1024LDAPOpCacheTTL 600<Location /portal> AuthType Basic #验证类型 AuthName "Portal" #验证名,显示在验证栏 AuthLDAPEnabled on #启用LDAP验证 AuthLDAPBindDN cn=admin,dc=com #连接LDAP服务器的用户 AuthLDAPBindPassword '1' #连接LDAP服务器的用户密码 AuthLDAPURL ldap://127.0.0.1/dc=user,dc=company,dc=com?uid? #连接URL AuthLDAPAuthoritative on #只允许LDAP验证方式 Require valid-user SetHandler python-program# Add the path of your wiki directory PythonPath "['/data/moin/portal/'] + sys.path" PythonHandler MoinMoin.request::RequestModPy.run</Location> mod_ldap模块提供了一个监控LDAP认证连接Cache信息的功能,在配置文件中增加以下标签即可。<Location /cache-info>SetHandler ldap-status</Location>~ 重启Apache服务器使配置生效。现在我们就可以通过LDAP服务器中的用户连接MoinMion了。访问http://moinserver/cache-info即可显示LDAP认证连接Cache信息。 10.14.4. XML处理 如果你的系统中安装了4suite这个XML处理软件包,MoinMoin可在线解析XML文档。 MoinMoin会根据页面正文第一行是否以<?xml开头来判断是否要启动XML处理。MoinMoin也支持可在线解析DocBook文档,要支持在线解析DocBook文档,还需安装一个docboot-xsl包,该软件包包含把DocBook格式文档转换成HTML格式文档所需的样式表,安装完成后,HTML样式表位于/usr/share/xml/docbook/stylesheet/nwalsh/html目录。最后,我们需对MoinMoin进行配置,让它启动XSLT转换功能和指定转换DocBook的样式表目录。启动XSLT转换功能的选项是allow_xslt = 1,默认值为0,表示禁用XSLT转换功能。样式表目录选项为docbook_html_dir,在Debian Sarge中,它的默认值已是正确的啦,为/usr/share/xml/docbook/stylesheet/nwalsh/html/,不用修改。但权限有问题,不能被www-data所访问和修改,我们要用以下命令进行修改。debian:/usr/share/xml/docbook/stylesheet# chown -R www-data.www-data nwalsh 修改完成后,重启MoinMoin服务器。创建一个DocBook格式的文档,如:#format docbook<?xml version="1.0" encoding="utf-8"?><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" ><book> <chapter> <title>test</title> <para>test</para> </chapter></book> 按保存,MoinMoin会把上面的DocBook文档自动转换成HTML文档输出。注意,DocBoo文档的encoding一定要用utf-8。我是在python2.4环境下做以上测试的,在python2.3中测试不成功,会出现字符编码出错提示。还有一个问题就是不能使用本地的dtd文件,会提示docbookx.dtd文档不存在错误。好象上面示例使用网上的dtd就没问题,但利用网上dtd时,HTML输出速度慢。从上面的测试结果来看,在WiKi中自动转换DocBook还不是很实用,一个是速度问题,上面已说过。另一个是编辑器问题,基于Web的编辑界面大简单了,远远比不上emacs等工具。 10.14.5. 文档 有关MoinMoin的使用可参考自带的帮助文档,有很多都是中文版的了,查询起来很方便的。在MoinMoin的官方网站http://moinmoin.wikiwikiweb.de/上也有最新的教材可参考。有关中文化方面,现在的MoinMoin已支持I18n,会根据浏览器的设置自动显示多国语言。中文化支持也有很多志愿者在做,教材和帮助很多都是中文的了。如果你想为MoinMoin的中文化做贡献,请到http://moinmaster.wikiwikiweb.de/注册个帐号,然后把你的帐号放到MoinPagesEditorGroup页面就可以进行翻译了。 小提示: 任何用户在页面中添加ACL都需要有管理权限(admin)。 wikiconfig.py配置文档编码需是UTF-8格式的,如果不是UTF-8格式,就不能在该文档中使用中文。我们可用Kwrite编辑器来把它保存成UTF-8格式的。 /usr/lib/python2.3/site-packages/MoinMoin/theme目录存放MoinMoin的各种主题处理脚本,修改这些脚本可实现界面功能的增减,如取消标题搜索栏等。 /usr/share/moin/htdocs/目录下存放有各种主题的CSS文档,修改这些文档可实现界面风格的改变,如布局、字体大小和背景颜色等。 删除页面时,页面文件不会从data/pages目录真正删除,它只是把文件的当前版本号增一,并在edit-log中记录删除日志。要真正删除页面,只能通过shell删除页面所在的目录。 当用户创建个人页面后,每当用户编辑完任意一个页面,都会生成一个备份,存放在username/MoinEditorBackup目录下。个人页面是指以用户名命名的WiKi页面。


阅读全文(58890) | 回复(-2) | 编辑 | 精华
 


I have a happy synthetic eye regarding detail and may anticipate complications prior to they take place.
软件技术

Kevin(游客)发表评论于2013/9/29 18:27:34

You've got the most impressive websites.


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.078 second(s), page refreshed 144765536 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号