1,安装:
wget http://mirror.bit.edu.cn/apache//apr/apr-1.4.6.tar.gz ./buildconf && ./configure wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.1.tar.gz ./buildconf --with-apr=../apr-1.4.6 && ./configure --with-apr=../apr-1.4.6 && make && make install wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.3.tar.gz ./buildconf --with-apr=../apr-1.4.6 --with-apr-util=../apr-util-1.5.1 ./configure --enable-dav --enable-so --enable-maintainer-mode && make && make install wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz ./configure && make && make install wget http://mirror.bit.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz ./buildconf --with-apr=../apr-1.4.6 --with-apr-util=../apr-util-1.5.1 ./configure --with-apr=../apr-1.4.6 --with-apr-util=../apr-util-1.5.1 && make && make install wget http://mirror.bit.edu.cn/apache/subversion/subversion-1.7.6.tar.gz ./get-deps.sh ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr && make && make install
2,创建版本仓库
1,新建一个目录用于存储SVN所有文件 # mkdir /home/svn 2,新建一个版本仓库 # svnadmin create /home/svn/project 3,修改 /home/svn/project/conf/passwd 添加用户 [users] # harry = harryssecret # sally = sallyssecret 4,修改 /home/svn/project/conf/authz 修改用户访问策略 5,修改svnserve.conf文件,让用户和策略配置升效. [general] anon-access = none auth-access = write password-db = /home/svn/project/conf/passwd authz-db = /home/svn/project/conf/authz 6,启动服务器 # svnserve -d -r /home/svn 7,在客户端checkout代码库 svn co svn://192.168.25.162/myproject
3,配置支持使用http访问
创建svn帐号或修改密码:/usr/local/apache2/bin/htpasswd -b /home/svn/svn-auth-file example_user_id example_passwd 修改svn用户访问策略 vi /home/svn/svn-access-file [project:/] example_user_id = rw 创建svn目录 /usr/local/bin/svnadmin create /home/svn/example_folder_name 修改svn目录权限 chmod 777 /home/svn/example_folder_name 修改/usr/local/apache2/conf/httpd.conf增加 LoadModule dav_svn_module modules/mod_dav_svn.so ##LoadModule dav_module modules/mod_dav.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn> DAV svn SVNParentPath /home/svn AuthType Basic AuthName "Subversion repository" AuthUserFile /home/svn/svn-auth-file Require valid-user AuthzSVNAccessFile /home/svn/svn-access-file </Location> 通过浏览器访问:http://192.168.25.162:1080/svn/project 这是用户名和密码分别输入example_user_id example_passwd即可
注:
http://yp.oss.org.cn/software/show_resource.php?resource_id=720
http://blog.sina.com.cn/s/blog_4e7a61b50100e2z5.html
要把svnserve.conf password-db = passwd 和 authz-db = authz 的注释去掉才可以打开密码