TRAC安装
一:安装
环境:ubuntu
首先安装svn,
sudo apt-get
第一步:安装
参考网页:http://trac.edgewall.org/wiki/TracInstall
首先确保系统中有 Python-2.5, easy_install
安装:sudo easy_install Trac==0.11b2
第二步:配置工程环境
执行:trac-admin /path/to/myproject initenv
执行后按提示配置一些参数。
执行完后在conf目录下生成一个配置文件trac.conf。
关于这个文件的配置很复杂,具体参见:http://trac.edgewall.org/wiki/TracIni
其中最需要关心的是[trac] section
MySQL Connection String
If you want to use MySQL instead, you'll have to use a different connection string. For example, to connect to a MySQL database on the same machine called trac, that allows access to the user johndoe with the password letmein, the mysql connection string is:
mysql://johndoe:letmein@localhost:3306/trac
第三步:配置svn 这步是最关键的,trac本质是svn的web版,通过 WebDAV/DeltaV 协议与svn进行通信。
详细说明参见http://svnbook.red-bean.com/en/1.1/ch06s04.html#svn-ch-6-sect-4.4.2
在apache的配置文件中 httpd.conf需要配置
LoadModule dav_module modules/mod_dav.so LoadModule dav_svn_module modules/mod_dav_svn.so
下面是配置Location表现(用于指示apache如何处理所请求的连接的)
If you plan to support multiple Subversion repositories that will reside in the same parent directory on your local disk, you can use an alternative directive, the SVNParentPath directive, to indicate that common parent directory. For example, if you know you will be creating multiple Subversion repositories in a directory /usr/local/svn that would be accessed via URLs like http://my.server.com/svn/repos1, http://my.server.com/svn/repos2, and so on, you could use the httpd.conf configuration syntax in the following example:
<Location /svn> DAV svn # any "/svn/foo" URL will map to a repository /usr/local/svn/foo SVNParentPath /usr/local/svn </Location>
使用以上配置只是匿名访问,如果需要配置用户权限,可以使用htpasswd来配置,比如建立harry和sally两个用户的密码:
$ ### First time: use -c to create the file $ ### Use -m to use MD5 encryption of the password, which is more secure $ htpasswd -cm /etc/svn-auth-file harry New password: ***** Re-type new password: ***** Adding password for user harry $ htpasswd -m /etc/svn-auth-file sally New password: ******* Re-type new password: ******* Adding password for user sally
然后使用AuthType ,AuthName ,AuthUserFile 来加载密码文件
<Location /svn> DAV svn SVNParentPath /usr/local/svn AuthType Basic AuthName "Subversion repository" AuthUserFile /etc/svn-auth-file
Require valid-user </Location>
Adding Require valid-user tells Apache that all requests require an authenticated user
附录:svn的使用
为了把trac与svn绑定在一起首先要简单学习一下svn的使用:
参考http://svnbook.red-bean.com/en/1.1/ch03.html
所有命令的参考手册:http://svnbook.red-bean.com/en/1.1/ch09.html
1)在线帮助命令:svn help <subcommand>
2)--revision [Numbers, Keywords, and Dates]
Keywords
HEAD
The latest revision in the repository.
The “pristine” revision of an item in a working copy.
The last revision in which an item changed before (or at) BASE.
The revision just before the last revision in which an item changed. (Technically, COMMITTED - 1.)
Dates
svn checkout --revision {2002-02-17}
3)checkout
svn checkout http://svn.collab.net/repos/svn/trunk subv
-
Update your working copy
-
svn update
-
-
Make changes
-
svn add
-
svn delete
-
svn copy
-
svn move
-
-
Examine your changes
-
svn status
-
svn diff
-
svn revert
-
-
Merge others' changes into your working copy
-
svn update
-
svn resolved
-
-
Commit your changes
-
svn commit
-
5)There are several commands that can provide you with historical data from the repository:
-
svn log
-
Shows you broad information: log messages attached to revisions, and which paths changed in each revision.
svn diff
-
Shows you the specific details of how a file changed over time.
svn cat
-
This is used to retrieve any file as it existed in a particular revision number and display it on your screen.
svn list
-
Displays the files in a directory for any given revision.
6)svn import
创建软件库
$ svnadmin create /usr/local/svn/newrepos
$ svn import mytree file:///usr/local/svn/newrepos/some/project
Adding mytree/foo.c
Adding mytree/bar.c
Adding mytree/subdir
Adding mytree/subdir/quux.h
Committed revision 1.
7)mod_dav_svn Configuration Directives
http://svnbook.red-bean.com/en/1.1/re58.html
第五步:配置webdav
You must add the following snippet in your /etc/apache2/mods-available/dav_svn.conf file:
<Location /svn/myproject> DAV svn SVNPath /home/svn/myproject AuthType Basic AuthName "myproject subversion repository" AuthUserFile /etc/subversion/passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location>
sudo htpasswd -c /etc/subversion/passwd user_name
遇到的问题:
我想通过配置apache来使monimoni和trac可以同时使用,但是配置遇到了问题。
有一个很好的办法就是查看error.log
这个在site-available中的default配置文件中定义:ErrorLog /var/log/apache2/error.log
两片教程
http://trac.edgewall.org/wiki/TracOnDebian
http://trac.edgewall.org/wiki/TracOnUbuntu
通过使用我发现TRAC只能浏览版本的变化,并不能提交,甚至cheout都是不太方便的,应该有打包checkout的功能,但是我没有发现。
我觉得只能通过svn图形工具或者svn命令对svn进行操作,然后可以使用trac进行简单查看。
图形化工具:
http://yamadaserver.dip.jp/cgi-bin/trac/subdiversvn/trac.cgi
http://www.svn8.com/SVNSY/20080323/405.html
在ubuntu中使用esvn很好用。
把bob用户添加为TRAC_ADMIN权限后,可以使用web_admin对trac进行配置
$ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
第六部:安装插件
安装完插件后需要执行:
sudo trac-admin /var/lib/trac/lmxe upgrade
这样就不需要reload apache了。
trac插件网站: