1.首先需要安裝svn服務(wù),apache,svn模塊
[root@cuichengjie ~]#yum -y install mod_dav_svn subversion
[root@cuichengjie ~]# yum -y install httpd
啟動(dòng)apache并設(shè)置開機(jī)自啟
[root@cuichengjie ~]# systemctl start httpd
[root@cuichengjie ~]# systemctl enable httpd
打開防火墻并關(guān)閉selinux
[root@cuichengjie ~]# firewall-cmd --permanent --add-service=http
[root@cuichengjie ~]# firewall-cmd --permanent --add-service=https
[root@cuichengjie ~]# firewall-cmd --reload
[root@cuichengjie ~]# setenforce 0
setenforce: SELinux is disabled
2.添加用戶菩颖,設(shè)置用戶名密碼
所設(shè)置的用戶名和加密后的密碼存放在自己指定的位置
[root@cuichengjie conf.d]# htpasswd -cm /etc/svn-auth-conf cuichengjie
New password:
Re-type new password:
Adding password for user cuichengjie
[root@cuichengjie conf.d]# htpasswd -cm /etc/svn-auth-conf test
New password:
Re-type new password:
Adding password for user test
3.設(shè)置SVN目錄
[root@cuichengjie conf.d]# cd /var/www/
[root@cuichengjie www]# mkdir svn
[root@cuichengjie www]# cd svn
[root@cuichengjie svn]# svnadmin create test
[root@cuichengjie svn]# chown -R apache.apache test
4.對(duì)apache的配置文件進(jìn)行配置
可以修改 vim /etc/httpd/conf/httpd.conf按照自己的需求來修改端口菜皂、ServerName等內(nèi)容
這里只配置SVN
[root@cuichengjie ~]# cd /etc/httpd/conf.d/
[root@cuichengjie conf.d]# vim svn.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /test>
#自己所設(shè)置的存放SVN的文件夾名
DAV svn
SVNPath /var/www/svn/test
#這里出錯(cuò)會(huì)導(dǎo)致403
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
#上文所提到的用戶名密碼存放位置
Require valid-user
</Location>
5.重啟apache并開啟svn服務(wù)
在配置文件寫完后爬橡,需要重啟服務(wù)才能生效
[root@cuichengjie svn]# systemctl restart httpd
[root@cuichengjie svn]# svnserve -d -r /var/www/svn/test
[root@cuichengjie svn]# ps -ef |grep svn #查看是否成功開啟
root 24564 1 0 16:43 ? 00:00:00 svnserve -d -r /var/www/svn/test
root 24674 4309 0 16:43 pts/2 00:00:00 grep --color=auto svn
以下是成功后的演示
訪問本機(jī)IP/文件名
輸入設(shè)置的用戶名密碼
登錄成功后的界面
新建文件夾
SVN Checkout
輸入網(wǎng)址以及用戶名密碼
如圖所示
新建文件夾并創(chuàng)建文件
Commit
勾選文件并寫注釋
成功提交
web端刷新后顯示
再次重復(fù)上述過程
選擇所想要拉取的文件
成功拉取