安装httpd服务/svn服务
一、安装apache
# yum install httpd httpd-devel
# service httpd start
# chkconfig httpd on
# vi /etc/httpd/conf/httpd.conf
找到 ServerName 并释放注释修改成
ServerName localhost:80
防火墙中打开80端口:
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# service iptables restart
完成以上步骤后访问http://serverip/
如果可以返回Apache的响应页面说明httpd已配置完成 ,显示字段如下(截图太麻烦,有如下显示即可):
Testing 123..
This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that this site is working properly. This server is powered by CentOS.
二、安装SVN服务
# yum install mod_dav_svn subversion
mod_dav_svn 属httpd控制svn模块,必须安装
查看测试是否安装mod_dav_svn 模块
# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
# svn --version 显示如下说明svn已完成安装
[root@test-linux svn]# svn --version
svn, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
创建svn库主目录(多库模式,一份配置文件管理多个库)
# mkdir /opt/svn/test
#chown -R apache:apache /opt/svn/(注:此处一定要修改,不然会出现用http提交文件时出现svn could not begin a transaction的错误,httpd没有权限修改root创建的目录)
# ls /etc/httpd/conf.d
此时可以看到一个subversion.conf配置文件(如果没有则手动创建)
添加以下内容
# vi subversion.conf
<Location /opt/svn/>
DAV svn
SVNListParentPath on
SVNParentPath /opt/svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /opt/svn/passwd.http
AuthzSVNAccessFile /opt/svn/authz
Require valid-user
</Location>
RedirectMatch ^(/opt/svn)$ $1/
创建/opt/svn/passwd.http和/opt/svn/authz
# touch /opt/svn/passwd.http
# touch /opt/svn/authz
重启apache httpd服务
# systemctl restart httpd
三、添加用户密码
在/opt/svn/目录下查看已创建的authz 和passwd.http文件已存在,在此路径下执行htpasswd passwd.http testusr
输入初始密码确认后加入testusr用户(此处注意一定要修改的passwd.http文件为当前目录文件,不然访问时输入用户和密码无效)
添加完成后使用命令
svnserve -d -r /opt/svn 启动svn服务后 在浏览器访问 http://serverip/svn/test
会要求你输入用户密码,输入创建的testusr用户密码确定即可完成访问。
整个流程结束