5. 布署Apache
$ sudo trac-admin /var/www/trac/ deploy /var/www/trac/deploy
$ sudo chown -R www-data /var/www/trac
$ sudo gedit /etc/apache2/sites-available/svn
# 往文件中加入以下内容, 使用与SVN相同的用户验证
WSGIScriptAlias /trac /var/www/trac/deploy/cgi-bin/trac.wsgi
<Directory /var/www/trac/deploy/cgi-bin>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
<Location /trac/login>
AuthType Basic
AuthName "Trac Login"
AuthBasicAuthoritative off
AuthUserFile /dev/null
Auth_MySQL on
Auth_MySQL_Authoritative on
Auth_MySQL_Host localhost
Auth_MySQL_DB svn
Auth_MySQL_User root
Auth_MySQL_Password root
Auth_MySQL_Password_Table user
Auth_MySQL_Empty_Passwords off
Auth_MySQL_Encrypted_Passwords on
Auth_MySQL_Username_Field name
Auth_MySQL_Password_Field passwd
Auth_MySQL_Encryption_Types PHP_MD5
Require valid-user
</Location>
$ sudo a2enmod auth_mysql
$ sudo a2ensite svn
$ sudo /etc/init.d/apache2 restart
6. 完成Trac与SVN的整合
将SVN配置到Trac的配置文件trac.ini中。找到repository_dir配置项:
$ sudo vim /var/www/trac/conf/trac.ini
repository_dir = /var/www/svn/repos
访问 http://svn.my:8081/trac,大功告成!

