安装环境
安装步骤
1. 安装相关软件
Apache
yum install httpd httpd-devel
Subversion
yum install mod_dav_svn subversion
SSL
yum install mod_ssl openssl
2. 创建版本库
mkdir /home/SVN
cd /home/SVN
svnadmin create test
chown -R apache:apache /home/SVN
2. 修改配制文件: vim /home/SVN/test/conf/svnserve.conf
anon-access = none
auth-access = write
password-db = /home/SVN/svn_passwd
authz-db = /home/SVN/svn_authz
3. 修改(新增) /etc/httpd/conf.d/subversion.conf
<Location /svn>
DAV svn
SVNParentPath /home/SVN/
SVNListParentPath on
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /home/SVN/svn_http_passwd
AuthzSVNAccessFile /home/SVN/svn_authz
Require valid-user
SSLRequireSSL
</Location>
4. 创建用户
htpasswd -c /home/SVN/svn_http_passwd user1 #创建apache用户和密码文件,已有文件把-c去掉
htpasswd /home/SVN/svn_http_passwd user1
vim /home/SVN/svn_passwd 增加svn用户
[users]
user1=123456
vim /home/SVN/svn_authz 增加svn用户权限
[groups]
group1=user1 # 用户组,多个用户用逗号隔开
[test:/] # 设置test库的权限
@group1=rw # group1组里的用户有读写权限
*= # 其他用户没有任何权限
5. 配制https
cd /etc/pki/tls/private
openssl genrsa -out svn.key 1024
openssl req -new -key svn.key -out svn.csr
cd /etc/pki/tls/certs
openssl x509 -req -days 365 -in /etc/pki/tls/private/svn.csr -signkey /etc/pki/tls/private/svn.key -out svn.crt
vim /etc/httpd/conf.d/ssl.conf 修改:
SSLCertificateFile /etc/pki/tls/certs/svn.crt
SSLCertificateKeyFile /etc/pki/tls/private/svn.key
6. 启动
svnserve -d -r /home/SVN
service httpd start
or:
/usr/bin/svnserve -d -r /home/SVN
/usr/sbin/service httpd start
7. 打开防火墙端口
/sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT
8. 加入开机启动项:
vim /etc/rc.d/rc.local
增加:
/usr/bin/svnserve -d -r /home/sddSVN
/usr/sbin/service httpd start
如果之前不存在 rc.local,在创建该文件后需要执行: chmod +x /etc/rc.d/rc.local