Linux下的SVN服务器搭建

这里自己做个总结。

环境: contos7,百度云服务

下载svn服务器,必须是联网情况下。
yum -y install subversion

查看下载后的信息,安装位置及详细信息。
rpm -ql subversion

3.创建版本库目录,可以再chenjy目录上放置多个项目,不必为每个项目创建一个版本库。下面是我的版本库

mkdir /opt/svn/svnrepos/chenjy
创建版本库
svnadmin create /opt/svn/svnrepos/chenjy (chenjy 就是我的版本库)

4.进入conf配置修改,设置账号、权限。。。

cd /opt/svn/svnrepos/chenjy
查看版本库下面都有什么
[root@instance-45oh6r0z chenjy]# ll
total 24
drwxr-xr-x 2 root root 4096 Feb 21 18:02 conf
drwxr-sr-x 6 root root 4096 Feb 21 18:22 db
-r–r–r-- 1 root root 2 Feb 20 17:49 format
drwxr-xr-x 2 root root 4096 Feb 20 17:49 hooks
drwxr-xr-x 2 root root 4096 Feb 20 17:49 locks
-rw-r–r-- 1 root root 229 Feb 20 17:49 README.txt
[root@instance-45oh6r0z chenjy]#
注释:
conf :存放版本库所使用的配置文件的目录
db :存放存储版本数据的数据库文件的目录
hooks :存放版本库钩子程序的目录
locks :存放库锁目录,用来跟踪库的访问者
format:存储一个整数的文件,此整数代表库层次结构版本
README.txt:版本库自述文件

4.2设置账号

[root@instance-45oh6r0z chenjy]# cd conf
[root@instance-45oh6r0z conf]# ll
total 12
-rw-r–r-- 1 root root 1080 Feb 20 17:49 authz
-rw-r–r-- 1 root root 309 Feb 20 17:49 passwd
-rw-r–r-- 1 root root 3090 Feb 20 17:49 svnserve.conf
注释:
authz:负责账号权限的管理,控制账号是否读写权限
passwd:负责账号和密码的用户名单管理
svnserve.conf:svn服务器配置文件

[root@instance-45oh6r0z chenjy]# cd conf
[root@instance-45oh6r0z conf]# ll
total 12
-rw-r--r-- 1 root root 1100 Feb 20 18:05 authz
-rw-r--r-- 1 root root  331 Feb 21 18:02 passwd
-rw-r--r-- 1 root root 3082 Feb 20 18:10 svnserve.conf
[root@instance-45oh6r0z conf]# vim authz


---------------------------以下是authz文件内容
### 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
             
# [/foo/bar]
# harry = rw
# &joe = r
# * =

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

只需在末尾添加,无需在文件其他部分修改和添加任何东西末尾内容如下:[\]
然后设置 账号 = 权限
r:读
w:写
:wq 保存退出即可

4.3修改密码

 [root@instance-45oh6r0z 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
cjy = 123456
zb = 123456
~                                                                                                                                                         
为刚才设置的账号设置密码: 账号 = 密码 cjy = 123456

4.4修改svnserve.conf(重要)

 [root@instance-45oh6r0z conf]# vim svnserve.conf
在这里插入图片描述

 


大多数网络资料,都会让大家将authz-db = authz这条给去掉注释,经过我本人多次被坑经验,此条去掉后,虽然svn服务器可以连接,但一直会提示“认证失败”,注释掉即可正常。还有多数资料会让大家在realm = My First Repository处填写服务器ip,经过测试,填写后并无什么用处,所以大家去掉注释即可,无需做任何修改到此,配置已经全部完成,账号信息已经添加成功

注意下面:开启防火墙的状态下需要开放 svn 端口:3690,怎么添加对外端口contos6与7是不一样的,根据自己情况查一下
我这里直接关闭了防火墙。

5.启动svn服务器

svnserve -d -r /opt/svn/svnrepos

启动成功后,可用ps -aux查看服务启动是否成功,这个是显示所有的运行进程

[root@instance-45oh6r0z conf]# ps -ef |grep svn
root 77711 1 0 Feb20 ? 00:00:00 svnserve -d -r /opt/svn/svnrepos
root 87594 87147 0 10:48 pts/0 00:00:00 grep --color=auto svn

pid=77711就是svn服务器,至于关闭,kill -9 pid 即可

6:客户端访问svn服务器,上传检出文件

在windows客户端,输入地址:svn://ip地址:3690/chenjy
(iP地址为你linux的ip,xxxx为前文创建的版本库名称,3690为svn默认端口)
弹出输入用户名和密码,输入即可访问


 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值