1. 获取相关的软件包
wget http://subversion.tigris.org/downloads/subversion-1.6.2.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.2.tar.gz
wgethttp://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.17.tar.gz
2. 安装apache和svn
Ø 安装Apache
#tar zxvf httpd-2.2.17.tar.gz
#cd httpd-2.2.17
#./configure --prefix=/usr/local/apache --enable-dav --enable-so --enable-rewrite --enable-ssl --enable-maintainer-mode --with-mpm=worker
#make && make install
#make clean
启动服务:
#/usr/local/apache2/bin/apachectl –k start
Ø 安装svn
# mkdir /usr/local/svn
# tar zxvf subversion-1.6.2.tar.gz
# tar zxvf subversion-deps-1.6.2.tar.gz
# cd subversion-1.6.2
# ./configure --prefix=/usr/local/svn --with-apr-util=/usr/local/apache2 --with-apr=/usr/local/apache2 --with-apxs=/usr/local/apache2/bin/apxs --enable-maintainer-mode --with-zlib=/usr/local/zlib --with-ssl
# make && make install
3. 配置svn服务器
# useradd apache
#passwd apache
# mkdir -p /var/repos
# cd /usr/local/svn/bin/
# ./svnadmin create /var/repos/test
# ll /var/repos/test(查看此目录下是否多了些内容,如果是,svn安装成功)
# chmod 700 /var/repos
#chown -R apache:apache /var/repos
# vi /usr/local/apache2/conf/httpd.conf修改http.conf
User daemon改为:User apache
Group daemon改为:Group apache
添加下面的内容:
<Location /svn>
DAV svn
SVNParentPath /var/repos/
AuthzSVNAccessFile //var/repos/authz
AuthType Basic
AuthName "clo.com.cn"
AuthUserFile /var/repos/authfile
Require valid-user
</Location>
# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf作如下配置:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host3.example.com
DocumentRoot "/var/repos/test"
Alias /test "/var/repos/test"
<Directory "/var/repos/test">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerName 172.16.31.235/test
ErrorLog /var/repos/test/svn-error_log
CustomLog /var/repos/test/svn-access_log common
</VirtualHost>
# /usr/local/apache2/bin/htpasswd -c /var/repos/authfile username password
# cp /var/repos/test/conf/authz /var/repos
vi /var/repos/authz按下面内容修改:
[groups]
test = apache,wanjl
[test:/]
@test = rw
# cd /var/repos/test/conf/
# rm -rf authz passwd
# /usr/local/apache2/bin/apachectl -k start
# /usr/local/apache2/bin/htpasswd -c /var/repos/authfile apache
# /usr/local/apache2/bin/htpasswd -c /var/repos/authfile wanjl
4. 通过浏览器访问svn服务器
打开IE输入svn服务器地址:http://172.16.31.235/svn/test/
5. 通过客户端访问svn服务器
从http://tortoisesvn.net/downloads网站下载TortoiseSVN最新版,然后按默认安装即可。
安装完毕后,在桌面上点击右键->TortoiseSVN->Repo-Browser将弹出下面的界面,输入
http://172.16.31.235/svn/test/