1,安装
#yum install subversion
#svnserve --version 查看版本
安装了svn软件后建立svn库
#mkdir /home/svn/repos
#svnadmin create /home/svn/repos
执行上面命令后,会自动在repos下建立conf,db,format,hooks,locks,README.txt文件
2,配置
主要是配置conf文件夹的几个文件,authz, passwd, svnserve.conf
其中authz是权限控制,可以设置哪些用户可以访问哪些目录,passwd是设置用户和密码,svnserve是设置SVN相关的操作。
2.1 先设置passwd
[users]
# harry = harryssecret
# sally = sallyssecret
test=test
用户名=密码
2.2 再设置权限authz
authz 授权配置文件 内容格式如下:
其中grooups 里面的帐号 是和 passwd 中对应的(r
只读,w 只写,rw 读写都可)
[groups]
组名 = 帐号1,帐号2
[项目目录:/]
@组名 = rw
@组名 = r
帐号 = rw
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[repos:/]
test = rw
[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 = repos #认证命名空间,<span style="font-family: Arial; font-size: 13px; line-height: 21px; background-color: rgb(238, 238, 238);">认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。</span>
如果已经有svn在运行,可以换一个端口运行
svnserve -d -r /opt/svn/repos --listen-port 3391
这样同一台服务器可以运行多个svnserver
好了,启动成功后,就可以使用了。
建议采用TortoiseSVN, 连接地址为: svn://your server address (如果指定端口需要添加端口 :端口号)
连接后可以上传本地的文件,有效的管理你的代码。