服务器端搭建svn

前几天搭好了SVN服务器。

现在有一个很不好的现象就是网上搜到的问题解决方式都是复制粘贴,大部分都是浪费时间,让人感到绝望。

今天中午有空,就总结一下如何搭建svn服务器。

————————————————分割线——————————————

首先测试一下系统是否安装了SVN
执行命令svnserve –version

如果没有安装就执行  yum -y install subversion

1、建立SVN的根目录 
mkdir -p /home/svn/

2、建立一个产品仓库
mkdir -p /home/svn/shop/
svnadmin create /home/svn/shop/

3、修改版本配置库文件
vi /home/svn/shop/conf/svnserve.conf

修改成

  1. realm = shop  (这里shop就是你版本库的名字)
  2. authz-db = authz
  3. password-db = passwd
  4. auth-access = write
  5. anon-access = none # 注意这里必须设置,否则所有用户不用密码就可以访问

4、开始设置passwd用户账号信息vi /home/svn/shop/conf/passwd修改完之后的内容如下:

  1. ### This file is an example password file for svnserve.
  2. ### Its format is similar to that of svnserve.conf. As shown in the
  3. ### example below it contains one section labelled [users].
  4. ### The name and password for each user follow, one account per line.
  5. ### 在下面添加用户和密码,每行一组username = password
  6. [users]
  7. # harry = harryssecret
  8. # sally = sallyssecret
  9. ###===========下面是我添加的用户信息========#######
  10. user= password

5、开始设置authz. 用户访问权限vi /home/svn/shop/conf/authz

  1. ### This file is an example authorization file for svnserve.
  2. ### Its format is identical to that of mod_authz_svn authorization
  3. ### files.
  4. ### As shown below each section defines authorizations for the path and
  5. ### (optional) repository specified by the section name.
  6. ### The authorizations follow. An authorization line can refer to:
  7. ###  – a single user,
  8. ###  – a group of users defined in a special [groups] section,
  9. ###  – an alias defined in a special [aliases] section,
  10. ###  – all authenticated users, using the ‘$authenticated’ token,
  11. ###  – only anonymous users, using the ‘$anonymous’ token,
  12. ###  – anyone, using the ‘*’ wildcard.
  13. ###
  14. ### A match can be inverted by prefixing the rule with ‘~’. Rules can
  15. ### grant read (‘r’) access, read-write (‘rw’) access, or no access
  16. ### (”).
  17. [aliases]
  18. # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil,
  19.         Ltd./OU=Research Institute/CN=Joe Average
  20. # [groups]
  21. # harry_and_sally = harry,sally
  22. # harry_sally_and_joe = harry,sally,&joe
  23. # [/foo/bar]
  24. # harry = rw
  25. # &joe = r
  26. # * =
  27. # [repository:/baz/fuz]
  28. # @harry_and_sally = rw
  29. # * = r
  30. ###——————–下面我新加的————————###
  31. ###屏蔽掉上面的[groups] 因为在下面添加了
  32. [groups]
  33. devteam = user1, user2#devteam 项目组包括两个用户user1,user2
  34. [shop:/]
  35. @devteam = rw 项目组的成员对shop都有读写权限。

6、启动svn:svnserve -d -r /home/svn/ #默认的启动端口号为3690-d表示以daemon方式(后台运行)运行;-r /home/svn 指定根目录是/home/svn。

7、检查是否启动netstat -tunlp | grep svn如果显示以下信息说明启动成功tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 10973/svnserve


最后就可以 通过客户端(小乌龟)进行访问 svn://{your-server-ip}/shop/  根据提示输入账号密码即可。

ps:

1.

一定要注意,所购买的服务器是或否开启了3690端口并且对外开放,可以在本地telnet  ip 3690 ,如果提示无法连接,那么说明3690端口不对外开放,需要去阿里云安全组中修改安全规则。(当初就是这个问题卡了我几天,在服务器上修改iptables都没有用— —)

2.

如果连接svn服务器提示option except 说明,svnserve.conf 中配置语句前面有一个空格,应该删掉。

3.

最后代码迁出  注意开头是svn:ip

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值