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 [email protected]‘localhost‘ identified by ‘123456‘;
mysql> flush privileges;
mysql> quit
# mkdir -p /var/www/ming (创建trac项目ming)
# trac-admin /var/www/ming initenv
ming
mysql://tracadmin:[email protected]/trac
# chown -R www-data:www-data /var/www/ming
# cp /etc/apache2/sites-available/default /etc/apache2/site-available/ming
# vi /etc/apache2/site-available/ming
按a或i进入编辑模式
<VirtualHost 10.0.0.3:80> (原为<VirtualHost *:80>)
DocumentRoot /var/www
<Location />
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 /login>
AuthType Basic
AuthName "Trac"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://10.0.0.3:3268/DC=ming,dc=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPBindDN [email protected]
AuthLDAPBindPassword "123456"
authzldapauthoritative Off
require valid-user CN=Users,dc=ming,dc=com
</Location>
其它不变
按Esc键退出编辑模式
:wq (保存并退出)
# ln -s /etc/apache2/site-available/ming /etc/apache2/site-enabled/
# 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即可