SVN作为新一代代码版本管理工具,有很多优点,管理方便,逻辑明确,安全性高,代码一致性高。SVN数据存储有两种方式,BDB(事务安全表类型)和FSFS(一种不需要数据库的存储系统),为了避免在服务器连接中断时锁住数据,FSFS是一种更安全也更多人使用的方式。SVN的运行方式也有两种,一种是独立服务器,另一种是借助apache服务,各有利弊,下面就介绍一下这两种方式各自的部署步骤。
1、作为独立服务器运行:
①安装svn,使用本地yum源安装,操作系统镜像里自带的就有,yum install
svn,具体步骤请参考http://ailurus.blog.51cto.com/4814469/1168336;
②创建版本库:
mkdir /svn/project //创建版本库所在文件夹
svnadmin create --fs-type fsfs /svn/project/first
//创建版本库,如果需要使用bdb方式存储,则将fsfs改成bdb即可
③初始化版本库,即导入文件到版本库中:
svn import /home/software file:///svn/project/first --message "初始化版本"
//将home文件夹的文件导入版本库
svn list --verbose file:///svn/project/first //查看导入的文件
④启动svn服务,svn服务默认端口为3690,可以使用“netstat -ntlp”命令查看服务启动是否成功:
svnserve -d -r /svn/project
⑤修改策略控制文件,vi authz,如果以后要添加用户,就将用户名加在相应的用户组(admin或者user)后面即可:
### 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.