实战搭建 apache + svn 服务

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实战搭建 apache + svn 服务相关的知识,希望对你有一定的参考价值。

SVN 作为版本控制软件是非常优秀的免费软件,现在想通过http://.. 访问,本文介绍一下搭建。


1.系统环境

[[email protected] ~]# uname -r

2.6.32-642.6.1.el6.x86_64

[[email protected] ~]# cat /etc/redhat-release 

CentOS release 6.8 (Final)

系统IP:10.89.1.32


2.实战搭建

#安装所需要的软件

[[email protected] ~]# yum install subversion httpd mod_dav_svn -y

[[email protected] ~]# mkdir /var/repos -p

[[email protected] ~]# cd /var/repos/

[[email protected] repos]# ls

#创建项目文件目录 wolveszf.com 和 kjcat.com

[[email protected] repos]# svnadmin create /var/repos/wolveszf.com

[[email protected] repos]# svnadmin create /var/repos/kjcat.com

[[email protected] repos]# ls

kjcat.com  wolveszf.com

[[email protected] repos]# cd kjcat.com/

[[email protected] kjcat.com]# ls

conf  db  format  hooks  locks  README.txt

#修改访问权限

[[email protected] kjcat.com]#chown apache:apache /var/repos -R

[[email protected] kjcat.com]# chmod 777 /var/repos -R

#启动svn服务

[[email protected] kjcat.com]# svnserve -d -r /var/repos

#检查svn服务是否启动

[[email protected] kjcat.com]# netstat -antup |grep 3690

tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      1250/svnserve

[[email protected] kjcat.com]# cd /etc/httpd/conf.d/   

#创建密码和授权登录文件  

[[email protected] conf.d]# mkdir -p /home/svn

[[email protected] conf.d]# touch /home/svn/passwd

[[email protected] conf.d]# touch /home/svn/auth

#编辑配置文件,编辑前保存备份

[[email protected] conf.d]# cp subversion.conf subversion.conf.ori  

[[email protected] conf.d]# vi /etc/httpd/conf.d/subversion.conf 


#按大写G到最后,删除注释

#<Location /repos>

#   DAV svn

#   SVNParentPath /var/www/svn

#

#   # Limit write permission to list of valid users.

#   <LimitExcept GET PROPFIND OPTIONS REPORT>

#      # Require SSL connection for password protection.

#      # SSLRequireSSL

#

#      AuthType Basic

#      AuthName "Authorization Realm"

#      AuthUserFile /path/to/passwdfile

#      Require valid-user

#   </LimitExcept>

#</Location>

---------------------------------------------------

#修改为:


<Location /svn>

   DAV svn

   SVNParentPath /var/repos

      AuthType Basic

      AuthName "SVN of Septwolves"

      AuthUserFile /home/svn/passwd

      AuthzSVNAccessFile /home/svn/auth

      Require valid-user


</Location>

#重启apache 服务

[[email protected] conf.d]#service httpd restart 

#创建登录用户和密码

[[email protected] conf.d]# htpasswd -c /home/svn/passwd admin

New password: 

Re-type new password: 

Adding password for user admin

[[email protected] conf.d]# htpasswd  /home/svn/passwd tree

New password: 

Re-type new password: 

Adding password for user tree

[[email protected] conf.d]# htpasswd  /home/svn/passwd bob

New password: 

Re-type new password: 

Adding password for user bob


[[email protected] ~]# cat /home/svn/passwd

admin:lif8Y7KgCGDJc

tree:QoxoMU8cBG9zY

bob:SRhDLBBbuM0UM

#配置登录用户的权限

[[email protected] ~]# vi /home/svn/auth

[/]

admin = rw

[kjcat.com:/]

tree = rw

[wolveszf.com:/]

bob = rw


3.实战测试

浏览器输入:http://10.89.1.32/svn/kjcat.com/

技术分享

技术分享


本文出自 “知识改变命运” 博客,请务必保留此出处http://ahtornado.blog.51cto.com/4826737/1868155

以上是关于实战搭建 apache + svn 服务的主要内容,如果未能解决你的问题,请参考以下文章

搭建SVN版本控制服务器

LAMP 搭建

svn+apache搭建版本控制服务器

实战搭建SVN代码版本服务器

使用SVN+apache搭建版本控制服务器

RHEL6.4下搭建apache和subversion(SVN)