开发人员经常会上传代码,或者改对代码做一些更改。svn就是用来将修改后的代码更新到服务器上的。下面就来看一下怎么在Linux环境下搭建svn服务(subversion)。
步骤:
1、检查是否已经有svn
2、安装subversion
3、检查是否安装成功
4、创建svn资源仓库
5、新增用户及密码,配置权限,配置资源库权限
6、启动或者重启服务
7、从机安装subversion
8、测试
一、检查是否已经有svn
如果没有安装就会是下面的样子,提示找不到命令。
[root@localhost ~]# svnserve --version
-bash: svnserve: command not found
如果已经安装,会显示版本信息:
[root@localhost ~]# svnserve --version
svnserve, version 1.6.11 (r934486)
compiled Aug 17 2015, 08:37:43
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
二、安装
在Linux下安装的是subversion,直接用yum 安装即可。
[root@localhost ~]#
[root@localhost ~]# yum install -y subversion
三、检查安装是否成功
同样用的是 svnserve –version成功安装会显示版本信息
[root@localhost ~]# svnserve --version
四、创建svn资源仓库
配置文件就是在这一步生成。
[root@localhost ~]# svnadmin create /svndir
[root@localhost ~]# cd /svndir/
[root@localhost svndir]# ls
conf db format hooks locks README.txt
[root@localhost svndir]# cd conf/
[root@localhost conf]# ls
authz passwd svnserve.conf
五、新增用户及密码,配置权限
已经看到在仓库下面生成了三个文件
authz #权限配置文件
passwd #用户名密码文件
svnserve.conf #资源库配置文件
[root@localhost 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
yunwei = 123456
~
新增一行:
yunwei = 123456
新增用户“yunwei”,密码是“123456”