SVN+Apache搭建
2020-09-16 本文已影响0人
老哥很稳
1.首先需要安装svn服务,apache,svn模块
[root@cuichengjie ~]#yum -y install mod_dav_svn subversion
[root@cuichengjie ~]# yum -y install httpd
启动apache并设置开机自启
[root@cuichengjie ~]# systemctl start httpd
[root@cuichengjie ~]# systemctl enable httpd
打开防火墙并关闭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.添加用户,设置用户名密码
所设置的用户名和加密后的密码存放在自己指定的位置
[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.设置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.对apache的配置文件进行配置
可以修改 vim /etc/httpd/conf/httpd.conf按照自己的需求来修改端口、ServerName等内容
这里只配置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>
#自己所设置的存放SVN的文件夹名
DAV svn
SVNPath /var/www/svn/test
#这里出错会导致403
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
#上文所提到的用户名密码存放位置
Require valid-user
</Location>
5.重启apache并开启svn服务
在配置文件写完后,需要重启服务才能生效
[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
以下是成功后的演示
访问本机IP/文件名













