Ubuntu搭建trac平台步骤:
# apt-get install apache2
# apt-get install libapache2-mod-python
# apt-get install libapache2-mod-authnz-external
# a2enmod authnz_ldap
# apt-get install mysql-server-5.5 (设置root密码,如:123456)
# apt-get install python-mysqldb
# apt-get install python-setuptools
# easy_install Genshi==0.6
# easy_install Babel==0.9.6
# easy_install Trac==0.12.2
# mysql -u root -p123456
mysql> create database trac;
mysql> grant all on trac.* to tracadmin@'localhost' identified by '123456';
mysql> flush privileges;
mysql> quit
# mkdir -p /var/www/ming (创建trac项目ming,多个trac得建多个目录,并做initenv操作)
# trac-admin /var/www/ming initenv
ming
mysql://tracadmin:[email protected]/trac (或 sqlite:db/trac.db,用mysql多个trac得建多个数据库,sqlite可用1个数据库)
# chown -R www-data:www-data /var/www/ming (一定要记得修改权限)
# vi /etc/apache2/http.conf (要建多个trac,上面操作后把里面内容复制一份即可)
按a或i进入编辑模式
<Location /ming>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/www/ming
PythonOption TracUriRoot /
SetEnv PYTHON_EGG_CACHE /tmp
</Location>
<Location /ming/login> (将该下所有登录控制写到上面/框架里可实现必须登录才能打开trac页面)
AuthType Basic
AuthName "Trac"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://10.0.0.3:3268/DC=ming,dc=com?sAMAccountName?sub?(objectClass=user)" (只允许某个ou人员登录,ldap://10.0.0.3:3268/ou=aa,dc=ming,dc=com?sAMAccoutName?sub?,后面为require valid-user)
AuthLDAPBindDN [email protected]
AuthLDAPBindPassword "123456"
authzldapauthoritative Off
require valid-user (valid-user为所有用户,ldap-user为单个用户,多个用户中间空格隔开,ldap-group为某个ou)
</Location>
其它不变
按Esc键退出编辑模式
:wq (保存并退出)
# service apache2 restart
注:
如果报错:TimeoutError:Unable to get database connection within 0 seconds. (TracError
(<babel.support.LazyProxy object at 0x7fe1d6e089b0>,))
是trac.ini的权限没设置好
# chown www-data:www-data /var/www/ming/conf/trac.ini即可
给某个账号管理员权限(可以是域账号)
# trac-admin /var/www/ming permission add zhi.yang TRAC_ADMIN
(会多出删除页面、删除附件等按钮)
删除管理员权限
# trac-admin /var/www/ming permission remove zhi.yang TRAC_ADMIN
查看所有账号的权限:
# trac-admin /var/www/ming permission list
trac删除附件(上面给过管理员权限,就不需要命令了):
# trac-admin /var/www/ming attachment remove wiki:WikiStart aa.rar
新建wiki页面:
编辑原有页面,在自己想放的位置输入"[wiki:aa]",(aa为页面名),点击保存,aa即会显示会链接,然后点击链接即会让新建页面
本文出自 “linux” 博客,谢绝转载!