安装SVN和Apache
wget http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco &>/dev/null
rpm --import /tmp/RPM-GPG-KEY-WANdisco
rm -rf /tmp/RPM-GPG-KEY-WANdisco
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/mod_dav_svn-1.6.18-1.x86_64.rpm
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/subversion-1.6.18-1.x86_64.rpm
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/subversion-devel-1.6.18-1.x86_64.rpm
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/subversion-perl-1.6.18-1.x86_64.rpm
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/subversion-python-1.6.18-1.x86_64.rpm
wget http://opensource.wandisco.com/centos/5/RPMS/x86_64/subversion-tools-1.6.18-1.x86_64.rpm
yum install subversion-1.6.18-1.x86_64.rpm
yum install subversion-perl-1.6.18-1.x86_64.rpm
yum install subversion-python-1.6.18-1.x86_64.rpm
yum install subversion-tools-1.6.18-1.x86_64.rpm
yum install mod_dav_svn-1.6.18-1.x86_64.rpm
yum install subversion-devel-1.6.18-1.x86_64.rpm
备注:CentOS上源码安装Subversion非常麻烦,所以直接使用wandisco的RPM。
安装Submin:
cd /usr/local/src
wget http://supermind.nl/submin/current/submin-1.2.11-1.tar.gz
tar -zxvf submin-1.2.11-1.tar.gz
cd submin-1.2.11-1
python bin/install.py /usr/local/
/usr/local/bin/submin-admin create default
Apache files created:
/etc/submin/default-apache-wsgi.conf
/etc/submin/default-apache-cgi.conf
Please include one of these in your apache config. Also make sure that
you have mod_dav_svn and mod_authz_svn enabled.
Created submin configuration with default user admin (password: admin)
将生成的default-apache-cgi.conf文件连接到httpd配置文件目录下的conf.d,这样这个配置自动加载入httpd.conf中
ln -s /etc/submin/default-apache-cgi.conf /etc/httpd/conf.d/submin.conf
ls -lst /etc/httpd/conf.d/submin.conf
4 lrwxrwxrwx 1 root root 35 Sep 8 15:31 /etc/httpd/conf.d/submin.conf -> /etc/submin/default-apache-cgi.conf
创建SVN仓库:
svnadmin create /home/svn
将SVN仓库关联到Submin
cd /var/lib/submin
ln -s /home/svn /var/lib/submin/svn/svn
确认submin的default.conf配置文件
cd /etc/submin
view default.conf
[svn]
authz_file = /var/lib/submin/authz (SVN权限文件)
userprop_file = /var/lib/submin/userproperties.conf (submin用户文件)
access_file = /var/lib/submin/htpasswd (SVN用户文件)
repositories = /var/lib/submin/svn (submin对应的SVNParentPath位置)
[www]
base_url = /submin
svn_base_url = /svn
trac_base_url = http://example.com/trac (要添加这一项,否则Submin页面中在配置SVN仓库权限的时候,会报错。)
[backend]
bindir = /usr/local/share/submin/bin
[generated]
session_salt = 92fcc/nQ/01AG3ny
确认&修改submin的default-apache-cgi.conf配置文件:
cd /etc/submin
vi default-apache-cgi.conf
Alias /submin /usr/local/share/submin/www
<Directory /usr/local/share/submin/www>
Order allow,deny
Allow from all
Options ExecCGI FollowSymLinks
AddHandler cgi-script py cgi pl
SetEnv SUBMIN_CONF /etc/submin/default.conf
RewriteEngine on
RewriteBase /submin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ submin.cgi/$1
RewriteRule ^/?$ submin.cgi/
</Directory>
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/lib/submin/svn(SVNParentPath位置)
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /var/lib/submin/htpasswd(SVN用户文件)
AuthzSVNAccessFile /var/lib/submin/authz(SVN权限文件)
Satisfy Any
Require valid-user
</Location>
关闭selinux的保护设置:
vi /etc/selinux/config
修改SELINUX=disabled setenforce 0
启动Apache:
service httpd start