一、编译安装subversion
#升级perl
# yum -y install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
# yum -y install cpan
# cpan ExtUtils::Install
# perl -MCPAN -e shell
cpan[1]> install CGI
cpan[2]> quit
# yum -y install perl-ExtUtils-Embed
# perl -MCGI -e 'print "CGI.pm version $CGI::VERSION\n";'
# find / -name CGI.pm -print 2>/dev/null
# cd /usr/software
# wget http://mirrors.axint.net/apache/apr/apr-1.4.6.tar.gz
# wget http://mirrors.axint.net/apache/apr/apr-util-1.5.1.tar.gz
# wget http://apache.etoak.com/subversion/subversion-1.7.7.tar.gz
# wget http://www.sqlite.org/sqlite-amalgamation-3071401.zip
# wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
# tar zxvf apr-1.4.6.tar.gz
# tar zxvf apr-util-1.5.1.tar.gz
# tar zxvf subversion-1.7.7.tar.gz
# tar zxvf neon-0.29.6.tar.gz
# unzip sqlite-amalgamation-3071401.zip
# mkdir -p /usr/software/subversion-1.7.7/sqlite-amalgamation
# cp /usr/software/sqlite-amalgamation-3071401/sqlite3.c /usr/software/subversion-1.7.7/sqlite-amalgamation/sqlite3.c
#安装apr
# cd apr-1.4.6
# ./configure --prefix=/usr/local/apr
# make && make install
# cd ..
#安装apr-util
# cd apr-util-1.5.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
# cd ..
#安装neon
# cd neon-0.29.6
# ./configure
# make && make install
#安装subversion
# cd subversion-1.7.7
# ./configure --prefix=/usr/local/subversion \
--with-apxs=/usr/local/apache/bin/apxs \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--without-berkeley-db
# make && make install
二、创建SVN的仓库目录结构
# mkdir -p /home/svn/
# /usr/local/subversion/bin/svnadmin create --fs-type fsfs /home/svn/repo
# ls /home/svn/repo/
conf db format hooks locks README.txt
# ls /home/svn/repo/conf/
authz passwd svnserve.conf
# chown -R www.www /home/svn/repo
# chmod -R +w /home/svn/repo
三、初始化dev01项目:
# mkdir -p dev01/{branches,tags,trunk}
# tree -L 2 dev01/
dev01/
|-- branches
|-- tags
`-- trunk
3 directories, 0 files
# /usr/local/subversion/bin/svn import dev01/ file:///home/svn/repo/dev01 -m "Initialize DEV01 project"
Adding dev01/trunk
Adding dev01/branches
Adding dev01/tags
Committed revision 1.
# mkdir -p dev02/{branches,tags,trunk}
# /usr/local/subversion/bin/svn import dev02/ file:///home/svn/repo/dev02 -m "Initialize DEV02 project"
# mkdir -p dev03/{branches,tags,trunk}
# /usr/local/subversion/bin/svn import dev03/ file:///home/svn/repo/dev03 -m "Initialize DEV03 project"
四、设置apache支持SVN,并配置SVN服务
# vi /usr/local/apache/conf/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNPath /home/svn/repo/
AuthzSVNAccessFile /home/svn/repo/conf/authz
AuthType Basic
AuthName "Subversion repo"
AuthUserFile /home/svn/repo/conf/passwd
Require valid-user
</Location>
:wq
# vi /usr/local/apache/conf/httpd.conf
Include conf/extra/httpd-vhosts.conf
Include conf/subversion.conf
:wq
# service httpd restart
五、设置SVN登录账户
# /usr/local/apache/bin/htpasswd -cm /home/svn/repo/conf/passwd admin
New password:
Re-type new password:
Adding password for user admin
# /usr/local/apache/bin/htpasswd -m /home/svn/repo/conf/passwd dev01
New password:
Re-type new password:
Adding password for user dev01
# /usr/local/apache/bin/htpasswd -m /home/svn/repo/conf/passwd dev02
New password:
Re-type new password:
Adding password for user dev02
# cat /home/svn/repo/conf/passwd
admin:***********************************
dev01:***********************************
dev02:***********************************
#修改用户密码
# /usr/local/apache/bin/htpasswd /home/svn/repo/conf/passwd dev01
六、设置SVN的管理权限
# vi /home/svn/repo/conf/authz
[groups]
admin=admin
team1=admin,dev01
team2=admin,dev02
[svn:/]
* = r
@admin = rw
[svn:/dev01]
@team1=rw
@team2=r
[svn:/dev02]
@team2 = rw
@team1 = r
[svn:/dev03]
@team2 = r
* =
:wq
七、重启Apache服务
# service httpd restart
#测试功能
http://192.168.203.80/svn
至此subversion安装完成。