yum -y install subversion #安裝SVN
svnserve -- version #查看svn版本信息肯定是否安裝
yum -y install httpd #安裝Apache
yum -y install mod_dav_svn #安裝Apache的SVN支持
mkdir -p /var/www/svn #建立SVN目錄
svnadmin create /var/www/svn/repos #建立repos版本庫
htpasswd -c /etc/httpd/conf.d/passwd.dav_svn admin #建立用戶密碼文件並添加用戶linux
vi /etc/httpd/conf.d/authz.dav_svn #編輯用戶權限配置 apache
[groups] #權限分組 manager=admin
[/] #根目錄
@manager=rw #manager組有讀寫權限
[repos:/]
#repos庫 *=r #全部人都有讀取權限 安全
vi /etc/httpd/conf.d/subversion.conf #編輯Apache的SVN配置
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/httpd/conf.d/passwd.dav_svn
AuthzSVNAccessFile /etc/httpd/conf.d/authz.dav_svn
Require valid-user
</Location>
ServerName localhost:80 #取消註釋,不然Apache啓動有警告
chown -R apache.apache /var/www/svn/repos #配置Apache對版本庫的訪問權限
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT #防火牆開啓80端口
/etc/init.d/iptables save #拷貝防火牆規則保存
chcon -R -t httpd_sys_content_t /var/www/svn/repos #添加Apache對版本庫目錄的selinux安全策略
chkconfig httpd on #系統啓動時Apache自動運行
service httpd start #啓動Apachetcp