Trac安装1 - 基本安装

——昨天trac集成账户管理和git的时候出现了麻烦,所以记录在此,以防后患。

假设已经安好:某数据库,apache2,python-setuptool。先准备好数据库:

#创建数据库,默认UTF8编码
CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

#授权访问数据库
GRANT ALL ON trac.* TO trac_user@localhost IDENTIFIED BY 'yourpassword';
 

1. 安装babel: sudo easy_install Babel==0.9.5  (可以看到2中其实已经默认依赖,如果用apt-get安trac的话,此步骤可略过)

2. 安装trac:sudo apt-get install trac, 会安装一坨东西(含Genshi),这个后悔呀~~。这个个步骤强烈建议用 easy_install trac(当然,需要自己安装Genshi)。

 3. 初始化trac 项目:trac-admin path_to_project initenv。在trac1.2中,只会提示输入项目名称和数据库连接。比如mysql设置如下:

mysql://trac_user:yourpassword@localhost/trac

4. 看一下效果:tracd --port 8000 path_to_project

5. 配置apache2:这里用mod_python(已经被官方deprecate)的方式,过程如下:

  • 安装mod_python:apt-get install -m libapache2-mod-python
  • 把trac项目的路径配置到apache2中:
<Location /trac> #set up Trac handling
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir path_to_project
    PythonOption TracUriRoot /trac
</Location>
  • 分配权限给apache2 user:sudo chown -R www-data.www-data path_to_project
  • 重启apache2

# TODO:用wsgi方式布置trac。

6. 重定向Apache2请求路径:

RedirectMatch permanent ^/$ /trac/my_project/login

RedirectMatch temp ^/trac/$ /trac/my_project/login

猜你喜欢

转载自woodyhuang.iteye.com/blog/1439308