Linux -CentOS7 搭建 SVN 服务器

9 篇文章 0 订阅
3 篇文章 0 订阅

使用root用户登录系统,否则执行以下命令前面加上 sudo

一, 安装subversion 

yum install -y subversion
二,查看安装的subversion 的安装位置

rpm -ql subversion
三,创建版本库

默认的地址为 /var/svn,可以修改 /etc/sysconfig/svnserve,我这里就不修改了,用默认的目录,

    

 mkdir -p /var/svn
svnadmin create /var/svn/cloud



四,配置

进入conf目录(该svn版本库配置文件)

  • authz文件是权限控制文件
  • passwd是帐号密码文件
  • svnserve.conf SVN服务配置文件


4.1 修改 passwd
vim passwd
在这个文件里加上以下内容 ,完整配置如下:

[root@node-4 conf]# vim passwd 
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.


[users]
# harry = harryssecret
# sally = sallyssecret
#




jack = 123456
test = 123456
vim authz
[root@node-4 conf]# vim authz 
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').


[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average


[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe




admin = jack
user = jack,test


[/]


@admin = rw
@user = rw


# [/foo/bar]
# harry = rw
# &joe = r
# * =


# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r


4.2 修改svnserve.conf, 去掉了注释:

[general]
anon-access = none
auth-access = write

password-db = passwd

authz-db = authz

realm = /var/svn/cloud

# force-username-case = none


[sasl]

# use-sasl = true

# min-encryption = 0
# max-encryption = 256
  • anon-access = read #匿名用户可读
  • auth-access = write #授权用户可写
  • password-db = passwd #使用哪个文件作为账号文件
  • authz-db = authz #使用哪个文件作为权限文件
  • realm = /var/svn/svnrepos # 认证空间名,版本库所在目录

4.3 启动svn 版本库

svnserve -d -r /var/svn

在windows 系统上测试svn服务器,在某目录 上右击,选择SVN CheckOut... ,输入svn://ip/cloud,正常情况下就会弹出一个用户验证框,输入用户名和密码就可以checkout代码或上传代码

注:如果出错,显示 “ /var/svn/cloud/conf/svnserve.conf:19: Option expected ”,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件,配置项要顶格写。

配置完后,杀掉svnserve进程,再一次启动版本库:

svnserve -d -r /var/svn
在window上测试就ok了





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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值