Trac安装手记

在服务器安装的手记。操作系统RHEL4。基本都是用RPM安装的。
原来就装好了SVN和httpd,trac的RPM除此外还依赖了clearsilver, sqlite, python-clearsilver, python-sqlite。依赖都装好了以后,rpm还不认为http已经安装,这时候用–no-deps强行把trac装上去就OK了。
过程中主要参考了Trac平台安装这个文档中的Rehat Linux这个。RHEL4对我反而没有什么太大的帮助,主要原因是服务器上没有yum:(不过幸运的是,我们可以直接跳过前面那个configure,make,makeinstall的步骤,直接开始配置。
配置的第一步是svn repository的建立,后面那个/var/svn的路径自已改,比如我就放在了/var/svn/ac990jcy,因为我喜欢一个项目一个repository

$ svnadmin create --fs-type=fsfs /var/svn

接下去是trac环境的建立

$ trac-admin /var/trac initenv/usr/local/lib/python2.3/site-packages/libsvn/core.py:5: RuntimeWarning: Python C API version mismatch for module _core: This Python has API version 1012, module _core has version 1011.  import _core/usr/local/lib/python2.3/site-packages/libsvn/fs.py:5: RuntimeWarning: Python C API version mismatch for module _fs: This Python has API version 1012, module _fs has version 1011.  import _fs/usr/local/lib/python2.3/site-packages/libsvn/delta.py:5: RuntimeWarning: Python C API version mismatch for module _delta: This Python has API version 1012, module _delta has version 1011.  import _delta/usr/local/lib/python2.3/site-packages/libsvn/repos.py:5: RuntimeWarning: Python C API version mismatch for module _repos: This Python has API version 1012, module _repos has version 1011.  import _reposCreating a new Trac environment at /var/trac
Trac will first ask a few questions about your environmentin order to initalize and prepare the project database.
 Please enter the name of your project. This name will be used in page titles and descriptions.
Project Name [My Project]> ac990jcy(项目的名称)
 Please specify the absolute path to the project Subversion repository. Repository must be local, and trac-admin requires read+write permission to initialize the Trac database.
Path to repository [/var/svn/test]> /var/svn(我用的是/var/svn/ac990jcy)
 Please enter location of Trac page templates. Default is the location of the site-wide templates installed with Trac.
Templates directory [/usr/local/share/trac/templates]> (Press enter here)(直接按enter)Creating and Initializing Project(Output removed)Project database for 'My Project' created.
 Customize settings for your project using the command:
   trac-admin /var/trac
 Don't forget, you also need to copy (or symlink) "trac/cgi-bin/trac.cgi" to you web server's /cgi-bin/ directory, and then configure the server.
 If you're using Apache, this config example snippet might be helpful:
    Alias /trac "/wherever/you/installed/trac/htdocs/"            SetEnv TRAC_ENV "/var/trac"
    # You need something like this to authenticate users            AuthType Basic        AuthName "My Project"        AuthUserFile /somewhere/trac.htpasswd        Require valid-user
 The latest documentation can also always be found on the project website: http://projects.edgewall.com/trac/
Congratulations!

然后像最后一段那样配置apache

Alias /trac "/usr/local/share/trac/htdocs/"   #要设置trac的环境,不然怎么读?   #或者用Set Env TRAC_ENV_PARENT_DIR "/var/trac"   #我就是parent,这样就可以管理多个项目了   SetEnv TRAC_ENV "/var/trac/ac990jcy"
# You need something like this to authenticate users   AuthType Basic
#使用HTTP Basic方法验证   AuthName "ac990jcy"#登录名   AuthUserFile /var/trac/conf/htpasswd#这个是登录用的密码文件   Require valid-user#需要登录?

生成密码文件,这是创建时候的命令,以后要添加的话就不要用’-c’选项了,不然以前的都没了

$ cd /var/trac/conf$ /usr/local/apache2/bin/htpasswd -c htpasswd admin

更改trac目录访问权限,不然httpd的权限很低的,没法读trac的目录

$ chmod -Rv a+rw /var/trac

拷贝trac.cgi

$ cd /usr/local/apache2/cgi-bin$ cp /usr/local/share/trac/cgi-bin/trac.cgi .

更改httpd运行用户 在httpd.conf里找到User daemon,Group daemon这一行,改成

User svnrootGroup svnroot

最后,用/usr/local/apache2/bin/apachectl -k restart/start 启动httpd,完成

Leave a Reply

Your email address will not be published.