CentOS安装并配置基于Apache的SVN服务器

42 篇文章 0 订阅

原文地址:http://www.centoscn.com/CentosServer/ftp/2015/1214/6518.html

参考地址:http://marionette.iteye.com/blog/1952577

http://blog.csdn.net/w171066/article/details/51218607

http://www.linuxidc.com/Linux/2013-03/81379p2.htm

http://blog.csdn.net/yuanchao99/article/details/24805175

http://www.centoscn.com/CentosServer/ftp/2015/0130/4600.html


http://xiaohailuo.blog.51cto.com/5812435/1826233  --可以参考

1、安装服务

    2、创建svn版本库

    3、创建svn用户

    4、配置svn权限

    5、配置http访问

 

#
#    1、安装服务,需要安装如下程序包:
#        subversion
#        httpd
#        mod_dav_svn
#
[root@svn-server ~] # yum install subversion httpd mod_dav_svn -y
#
#    2、创建svn版本库
#
#        创建存放svn版本库的目录/svn
#
[root@svn-server ~] # mkdir /svn
#
#        在/svn目录下使用svnadmin命令创建svn版本库repot,然后查看创建好的svn版本库
#
[root@svn-server ~] # svnadmin create /svn/repot
[root@svn-server ~] # ll /svn/repot
total 24
drwxr-xr-x. 2 root root 4096 Dec 13 22:52 conf
drwxr-sr-x. 6 root root 4096 Dec 13 22:52 db
-r--r--r--. 1 root root    2 Dec 13 22:52  format
drwxr-xr-x. 2 root root 4096 Dec 13 22:52 hooks
drwxr-xr-x. 2 root root 4096 Dec 13 22:52 locks
-rw-r--r--. 1 root root  229 Dec 13 22:52 README.txt
#
#    3、创建svn用户
#
#       使用htpasswd命令创建用户配置文件
#        -c            第一次创建用户的时候,同步创建用户配置文件(仅第一次)
#        -b            在htpasswd命令中明文配置密码
#        -m            使用MD5对密码进行加密
#        /svn/repot/conf/passwd    用户配置文件位置,文件名和存放目录没有要求
#        admin         用户名
#        123456        admin密码,因为前面使用了 -b 选项,所以必须在后面加上密码
#
[root@svn-server ~] # htpasswd -c -b -m /svn/repot/conf/passwd admin 123456
Adding password  for  user admin
#
#        创建第二个用户的时候就不需要 -c 选项了
#        不指定加密选项则在Linux上默认使用 -d 选项,crypt加密
#        不使用 -b 选项,则会提示你输入两次没有回显的密码,两次密码必须一致
#
[root@svn-server ~] # htpasswd /svn/repot/conf/passwd rouser
New password: 
Re- type  new password: 
Adding password  for  user rouser
#
#        查看用户配置文件:admin密码使用MD5加密,rouser密码使用crypt加密
#
[root@svn-server ~] # cat /svn/repot/conf/passwd 
admin:$apr1$R6KbqLSX$UwXTcVK6iCRfxlfyIbO4z/
rouser:UBx6tRs3XYOwI
#
#    4、配置svn权限
#
#        我们使用默认的svn权限配置文件进行配置,文件名和存放目录没有要求
#
[root@svn-server ~] # cat /svn/repot/conf/authz
[ groups ]                   #定义用户组,方便统一管理
all = admin,rouser       #定义一个组叫做“all”,包含“admin”和“rouser”
[/]                        #定义svn版本库根目录权限(子目录继承根目录权限)
* = r                    #所有用户有读权限
@all = r                 #用户组“all”中的所有用户有读权限
admin = rw               #admin用户有读权限和写权限
rouser = r        #rouser有读权限
#
#    5、配置http访问
#
#        编辑Apache配置文件 /etc/httpd/conf.d/subversion.conf
#
[root@svn-server ~] # cat /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules /mod_dav_svn .so   #加载dav_svn模块
LoadModule authz_svn_module   modules /mod_authz_svn .so   #加载authz_svn模块
<Location  /repot >                                           #针对repot版本库做访问配置
     DAV svn                                             #
     SVNPath  /svn/repot                                  #repot版本库路径
     AuthzSVNAccessFile  /svn/repot/conf/authz            #访问权限配置文件
     AuthType Basic                                      #http验证方式:Basic
     AuthName  "Authorization repot SVN"                #验证提示语
     AuthUserFile  /svn/repot/conf/passwd                 #用户配置文件
     Require valid-user                                  #限定用户只有输对了用户名和密码才能访问
     Satisfy Any                                         #ip没有被禁止或者完成账号密码验证就能访问
< /Location >
#
#        设置svn版本库下的目录和文件的所有者和属组为apache,允许通过http访问的用户可以读写svn版本库中的文件
#
[root@svn-server ~] # chown -R  apache.apache /svn/
[root@svn-server ~] # ll /svn/
total 4
drwxr-xr-x. 6 apache apache 4096 Dec 13 22:52 repot
#
#        重启http服务
#
[root@svn-server ~] # /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
#
#        设置svn服务开机启动
#
[root@svn-server ~] # chkconfig httpd on
[root@svn-server ~] # chkconfig --list |grep httpd 
httpd          0:off1:off2:on3:on4:on5:on6:off
#
#        注意配置好防火墙和SELinux,为了方便验证,可以临时关闭防火墙和SELinux
#
#        在浏览器或者svn客户端中访问 http://svn-server_ip/repot 验证svn已经可以访问
#
#        admin用户有读权限和写权限,rouser只有读权限
#
#########################################################################################################
#
#    修改用户配置文件和svn权限后立即生效,不需要重启服务
#
#        删除用户
#
[root@svn-server ~] # htpasswd -D /svn/repot/conf/passwd rouser
Deleting password  for  user rouser
[root@svn-server ~] # cat /svn/repot/conf/passwd 
admin:$apr1$R6KbqLSX$UwXTcVK6iCRfxlfyIbO4z/
#
#        重置密码,先使用crypt加密,后使用MD5加密
#
[root@svn-server ~] # htpasswd -b /svn/repot/conf/passwd admin 654321
Updating password  for  user admin
[root@svn-server ~] # cat /svn/repot/conf/passwd 
admin:dnCSoZ6Ja0drU
[root@svn-server ~] # htpasswd -b -m /svn/repot/conf/passwd admin 111111
Updating password  for  user admin
[root@svn-server ~] # cat /svn/repot/conf/passwd 
admin:$apr1$xGna7avC$F6Tkpd8iHs2ESCsu2Psl0.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值