svn 服务器在生产环境中的搭建
搭建环境
阿里云服务器 CentOS release 6.7
安装软件
yum install subversion -y
创建项目目录
cd /home/svnuser/svn
svnadmin create test1 #创建项目目录
查看配置配置文件
ls /home/svnuser/svn/test1
conf db format hooks locks README.txt
配置文件解释
conf #存放版本库所用配置文件的目录
db #版本数据存储目录
format # 存储一个整数的文件,此整数代表库层次结构版本
hooks # 存放版本库勾子目录
locks # 存储库锁目录,用来跟踪库的访问者
修改配置文件 (多个目录的话实现统一认证)
ls /home/svnuser/svn/test1/conf
authz passwd svnserve.conf
vim svnserve.conf 修改配置文件
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = none # 不允许匿名访问
auth-access = write # 允许写的权限
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd # 密码认证
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz # 用户权限配置
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
vim authz 修改权限配置文件
[groups] #定义组
test1=zhangyi 定义组中的用户
test2=zhanger
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/] //制定根目录下的权限
@test1 = rw
* = r //其他用户只有读权限
[svn/test:/] #定义目录,从启动目录下面的下一级目录开始写
@test1 = rw
* =r 其他用户只有读的权限
vim passwd #定义用户的密码
[users]
# harry = harryssecret
# sally = sallyssecret
zhangyi = test1
启动服务
svnserve -d -r /home/svnuser/
查看是否启动成功
[root@iZ28zk3a6Z svn]# netstat -anutp | grep 369
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 2501/svnserve
设置开机自启动
vim /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
添加下面一行
svnserve -d -r /home/svnuser/
客户端访问
下载客户端tortoiseSVN
打开资源库浏览器输入地址, svn://你的svn服务器ip:svn/test/
如遇到报错问题
Unable to connect to a repository at URL 'svn://ip/svn/test
需要清除下缓存
TortoiseSVN -> Settings -> Saved Data
点击个个“Clear”按钮,把本地缓存都清除了,点击“确定”;
本文出自 “10852974” 博客,转载请与作者联系!