svn安装配置文档

 
因为需要以http方式访问所以需要安装apache
apache安装
wget http://mirrors.sohu.com/apache/httpd-2.2.21.tar.bz2
yum -y install openssl openssl-devel
tar jxvf httpd-2.2.21.tar.bz2
./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --enable-dav    (dav为svn模块)
make && make install 
prefork 以及worker工作模式的区别
安装svn一下几个包可任选其一 
wget http://labs.renren.com/apache-mirror/subversion/subversion-1.7.1.tar.bz2
wget http://labs.renren.com/apache-mirror/subversion/subversion-1.7.2.tar.bz2
wget http://labs.renren.com/apache-mirror/subversion/subversion-1.7.2.tar.gz
wget http://subversion.tigris.org/downloads/subversion-1.6.17.tar.bz2
tar jxvf subversion-1.7.1.tar.bz2
cd subversion-1.7.1
mkdir sqlite-amalgamation
cd sqlite-amalgamation
wget http://www.sqlite.org/sqlite-autoconf-3070800.tar.gz
tar zxvf sqlite-autoconf-3070800.tar.gz
cd sqlite-autoconf-3070800
cp sqlite3.c ..
./configure --prefix=/usr/local/subversion
make && make install
cd subversion-1.7.1
./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=//usr/local/subversion --with-apr=/usr/local/apache2/ --with-apr-util=/usr/local/apache2/ --with-ssl with-zlib --enable-maintainer-mode
如果报错的话可以去掉with-zlib参数
make && make install
创建svn运行用户
groupadd svnroot
useradd svnroot -g svnroot
修改apache运行用户以及添加dav模块
vim /usr/local/apache2/conf/httpd.conf
添加
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
<Location /svn>
  DAV svn
  SVNParentPath /home/svnroot/repository/
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /home/svnroot/repository/authfile
  Require valid-user
  AuthzSVNAccessFile /home/svnroot/repository/authz.conf
</Location>
修改
User svnroot
Group svnroot
创建svn存放数据目录(svnroot用户进行下面的操作)
mkdir -p /home/svnroot/repository/
为svn添加apache认证用户
/usr/local/apache2/bin/htpasswd -c /home/svnroot/repository/authfile yanxiaobin
-c参数用于创建/home/svnroot/repository/authfile文件,创建第二个用户开始不要使用-c,否则会覆盖原来的文件
 
创建svn版本库(test)
/usr/local/subversion/bin/svnadmin create /home/svnroot/repository/test
看看/home/svnroot/repository/test是不是里面有文件
 
创建权限控制文件authz.conf
touch /home/svnroot/repository/authz.conf
 
修改权限:
chmod 700 /home/svnroot -R
chown -R svnroot.svnroot /home/svnroot
权限不对会导致web页面无法登陆问题
 
权限配置示例
[groups]
group_a=zhang3.li4.wang5  定义组a
group_b=zhao1,qian2  定义组b
group_admin=wo  定义组admin
[test:/] 父库test
@group_admin=rw 组admin的成员有读写权限
@group_a=r a组成员有读权限
@group_b= b组成员没有权限
*= 未授权用户没有权限
abc=r abc用户有读权限
bcd=rw bcd用户有读写权限
[test:/a]  test库的子目录a    (/test/a/)
@group_a=r   
*=
@group_admin=rw
 
 
测试svn是否安装成功
svnserve --version
 
 
重启apache
/usr/local/apache2/bin/apachectl -k restart
 
网页访问:abc是库名
http://192.168.18.40/svn/abc/
客户端下载svn客户端软件,使用方法自行参悟!!!