在ubuntu10.04,trac可以直接在software center中找到,安装过程中会连带svn、apache都装上。
各种配置可在http://wiki.ubuntu.org.cn/Trac%E7%9A%84%E5%AE%89%E8%A3%85%E8%AE%BE%E7%BD%AE 中找到。
在/var/trac/目录下创建trac environment。www-data为apache的默认用户,让其能对目录有读写权限。
sudo mkdir projectname
sudo chown -R www-data:www-data projectname
sudo -u www-data trac-admin projectname initenv
为apache添加python模块
sudo apt-get install libapache2-mod-python libapache2-mod-python-doc
通过ubuntu10.04 software center安装的trac系0.11+的,已经集成webadmin插件。
通过下列命令创建管理员帐号
trac -admin /path/to/my/project
permission add username-from-htpasswd TRAC_ADMIN
permission list username-from-htpasswd
在software center中找到trac-AccountManager并安装
参考http://trac-hacks.org/wiki/AccountManagerPlugin#AccountManager
在当前trac environment中启用Account Manager模块
添加如下内容到trac.ini
[components]
trac.web.auth.LoginModule = disabled
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.admin.AccountManagerAdminPage = enabled #(在web admin里面添加用户管理界面)
acct_mgr.web_ui.AccountModule = enabled #(在Preferences里添加账户管理界面,修改密码和删除用户)
acct_mgr.web_ui.RegistrationModule = enabled
acct_mgr.htfile.HtPasswdStore = enabled #(使用htfile来管理用户密码,有其他多种方案,查阅上面的链接)
[account-manager]
password_store = HtPasswdStore
password_file = /var/trac/projectname/.htpasswd
在apache的配置文件httpd.conf中添加location
<Location /projectname>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/trac/projectname
PythonOption TracUriRoot /projectname
SetEnv PYTHON_EGG_CACHE /tmp
</Location>