`
blogfeifei
  • 浏览: 1197807 次
文章分类
社区版块
存档分类
最新评论

Linux 下 Trac SVN apache SSL 配置安装以及整合

 
阅读更多

trac + SVN + apache(SSL) 安装
1. 简介:
由于项目需求,所以要部署一台Trac并且和现有的SVN整合. 至于什么是Trac和SVN,就不多介绍了.
2. 安装步骤:
(1) 安装apache(此步骤略)
(2) 安装SVN
shell > wget http://subversion.tigris.org/downloads/subversion-1.5.6.tar.gz
shell > tar zxvf subversion-1.5.6.tar.gz
shell > cd subversion
shell > ./configure –with-apxs=/usr/local/apache/bin/apxs –prefix=/usr/local/svn –with-apr=/usr/local/apache –with-apr-util=/usr/local/apache –with-

ssl –enable-maintainer-mode –without-berkeley-db PYTHON=/usr/bin/python –with-swig=/usr/bin/swig –enable-shared –enable-static –enable-swig-

binding=python
shell > make && make install
(3) 配置apache:
创建证书:
shell > maker /usr/local/apache/conf/key
shell > cd /usr/local/apache/conf/key
shell > openssl genrsa -out xuan-lu.key 1024
shell > chmod 600 /usr/local/apache/key/xuan-lu.key
shell > openssl req -new -key xuan-lu.key -out xuan-lu.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:China
Locality Name (eg, city) [Newbury]:Shang Hai
Organization Name (eg, company) [My Company Ltd]:99 Roses
Organizational Unit Name (eg, section) []:99 Roses
Common Name (eg, your name or your server’s hostname) []:xuan-lu
Email Address []:martin@xuan-lu.net

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:xuan-lu
An optional company name []:xuan-lu
shell > openssl x509 -req -days 365 -in xuan-lu.csr -signkey xuan-lu.key -out xuan-lu.crt
shell > ls
xuan-lu.crt xuan-lu.csr xuan-lu.key
配置apache:
shell > /usr/local/apache/bin/htpasswd -c /home/svn/user/svn_user.conf martin
New password:
Re-type new password:
Adding password for user martin

shell > vi /usr/local/apache/conf/httpd.conf
取消对下的ssl的注释:
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

shell > vi /usr/local/apache/conf/extra/httpd-ssl.conf
添加如下:
<VirtualHost *:443>
ServerName svn.xuan-lu.net
SSLEngine on
SSLCertificateFile "/usr/local/apache/key/xuan-lu.crt"
SSLCertificateKeyFile "/usr/local/apache/key/xuan-lu.key"
<Location />
DAV svn
SVNPath /home/svn/xuan-lu/
AuthType Basic
AuthName "xuan-lu!!! SVN"
AuthUserFile /home/svn/user/svn_user.conf
AuthzSVNAccessFile /home/svn/xuan-lu/conf/authz
Require valid-user
</Location>
</VirtualHost>
shell > service httpd restart
注: 解释下SVN 的权限配置文件的使用
[groups]
admin = martin
user_r = user_1
user_rw = user_2
[/]
* =
@admin = rw

[/xuan-lu]
@user_r = r
@user_rw = rw
用户分别分为admin,user_r和user_rw三个组,其中只有admin组用户对/(根)目录有读写权限,组user_r对/99rose目录仅仅有读的权限,而组user_rw对/xuan-lu目录具备读写

的权限.根据不同的需求可以定制不同的权限,这里不多做介绍.

(2) 安装trac
shell > cd /home/tools/subversion (个人习惯在/home/目录下创建一个tools目录用来放置源码包)
shell > make swig-py
shell > make install-swig-py
shell > echo /usr/local/svn/lib/svn-python > /usr/lib/python2.4/site-packages/subversion.pth
验证svn-python (没报错即可)
shell > python
>>>import svn.repos
>>>
shell > cd /home/tools/
shell > wget http://ftp.edgewall.com/pub/trac/Trac-0.11.5.tar.gz
shell > tar zxvf Trac-0.11.5.tar.gz
shell > cd Trac-0.11.5
shell > wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg#md5=260a2be2e5388d66bdaee06abec6342a
shell > sh setuptools-0.6c9-py2.4.egg
shell > python ./setup.py install
生成 trac
shell > trac-admin /home/svn/trac_xuan-lu initenv
Creating a new Trac environment at /home/svn/trac_xuan-lu

Trac will first ask a few questions about your environment
in order to initialize 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]> 99 Roses !!!
Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).

Database connection string [sqlite:db/trac.db]>
Please specify the type of version control system,
By default, it will be svn.

If you don’t want to use Trac with version control integration,
choose the default here and don’t specify a repository directory.
in the next question.

Repository type [svn]>

Please specify the absolute path to the version control
repository, or leave it blank to use Trac without a repository.
You can also set the repository location later.

Path to repository [/path/to/repos]> /home/svn/xuan-lu

… …

配置Apache( 安装mod_python 以及配置 trac)
shell > cd /home/tools/
shell > wget http://apache.freelamp.com/httpd/modpython/mod_python-3.3.1.tgz
shell > ./configure –with-apxs=/usr/local/apache/bin/apxs
shell > vi vi src/connobject.c
… …
141 while ((bytes_read < len || len == 0) &&
142 !(b == APR_BRIGADE_SENTINEL(bb) ||
143 APR_BUCKET_IS_EOS(b) || APR_BUCKET_IS_FLUSH(b))) {
… …
修改142行为上所示(原为 !(b == APR_BRIGADE_SENTINEL(b) || )
否则会报如下错误:
… …
connobject.c:142: error: request for member ……in something not a structure or union
apxs:Error: Command failed with rc=65536
.
make[1]: *** [mod_python.so] Error 1
make[1]: Leaving directory `/home/tools/mod_python-3.3.1/src’
make: *** [do_dso] Error 2
shell > make && make install
shell > vi /usr/local/apache/conf/httpd.conf
… …
LoadModule python_module modules/mod_python.so
… …
配置虚拟主机:
shell > vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /home/svn/trac_xuan-lu
ServerName trac.xuan-lu.net
<Location "/">
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /home/svn/trac_xuan-lu
PythonOption TracUriRoot /
AuthType Basic
AuthName "xuan-luTrac Server"
AuthUserFile /home/svn/user/svn_user.conf
Require valid-user
</Location>
<Directory "/home/svn/trac_xuan-lu">
AllowOverride All
Order Deny,Allow
</Directory>
</VirtualHost>
打开IE 输入:http://trac.xuan-lu.net 验证是否存在问题
到此为止 trac 和 apache 以及 SVN 的整合 已经结束 下面将介绍一些简单的修改.

1. 开启trac 的webadmin功能:
shell > vi /home/svn/trac_xuan-lu/conf/trac.ini
在配置文件结尾加上
[components]
webadmin.* = enabled
给予martin 用户 webadmin 权限:
shell > trac-admin /home/svn/trac_xuan-lu/
Welcome to trac-admin 0.11.5
Interactive Trac administration console.
Copyright (c) 2003-2009 Edgewall Software

Type: ‘?’ or ‘help’ for help on commands.
Trac [/home/svn/trac_xuan-lu]> permission add martin TRAC_ADMIN
Trac [/home/svn/trac_xuan-lu]>
刷新页面用martin用户登录,就会发现,多了admin选项
2. 更改trac左上方的logo
shell > vi /home/svn/trac_xuan-lu/conf/trac.ini
… …
[header_logo]
alt = (please configure the [header_logo] section in trac.ini)
height = -1
link = /
src = http://www.xuan-lu.net/logo.jpg
width = -1
… …

3. Trac整合SVN用户权限:
shell > vi /home/svn/trac_xuan-lu/conf/trac.ini
… …
[trac]
authz_file = /home/svn/xuan-lu/conf/authz
authz_module_name = xuan-lu
… …
4. 解决trac中SVN源文件乱码问题:
shell >
… …
[trac]
default_charset = utf-8 (原来为:iso-8859-15)
… …
6. 用户权限配置:
(1) 使用martin登录
(2) 选择admin
(3) 选择左侧:Permissions选项
(4) 可以看到配置用户的权限选项了(界面的右侧)
权限根据自己实际需求去进行操作:
BROWSER_VIEW # 查看版本库
CHANGESET_VIEW # 查看修改记录
FILE_VIEW # 查看文件内容
LOG_VIEW # 查看日志
MILESTONE_VIEW # 查看里程杯
REPORT_SQL_VIEW # 查看报告查询语句
REPORT_VIEW # 查看报告
ROADMAP_VIEW # 查看路标
SEARCH_VIEW # 显示查找
TICKET_CREATE # 创建任务单
TICKET_MODIFY # 修改任务单
TICKET_VIEW # 显示任务单
TIMELINE_VIEW # 查看时间
WIKI_CREATE # 创建wiki
WIKI_MODIFY # 修改wiki
WIKI_VIEW # 查看wiki

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics