系统环境:CentOS 5.4 x64
应用环境:生产环境,测试环境
安装apr
$ tar zxf apr-1.4.2.tar.gz
$ cd apr-1.4.2
$ ./configure
$ make && make install
安装apr-util
$ tar zxf apr-util-1.3.10.tar.gz
$ cd apr-util-1.3.10
$ ./configure --prefix=/usr/local/apr
$ make && make install
安装sqlite
$ tar zxf sqlite-amalgamation-3.6.13.tar.gz
$ cd sqlite-3.6.13/
$ ./configure
$ make && make install
--------------------------------------------
出现下面提示不用理会
configure: WARNING: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL. We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end. You can find the latest version of
Berkeley DB here:
---------------------------------------------
安装subversion
$ tar zxf subversion-1.6.12.tar.gz
$ cd subversion-1.6.12
$ ./configure --prefix=/usr/local/subversion --with-apr-util=/usr/local/apr --with-apr=/usr/local/apr --without-berkeley-db
$ make && make install
在/etc/profile的PATH变量后面添加/usr/local/subversion/bin这个路径
$ echo 'PATH=/usr/local/subversion/bin:$PATH' >> /etc/profile
$ source /etc/profile
安装完毕检查版本
$ /usr/local/subversion/bin/svnserve --version
-----------------------------------------------------------------
svnserve, version 1.6.12 (r955767)
compiled Apr 28 2011, 10:15:47
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet ().
The following repository back-end (FS) modules are available:
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
-----------------------------------------------------------------
建立仓库根目录
$ mkdir -p /opt/svn
$ useradd svn
$ chown svn:svn -R /opt/svn/
启动SVN服务,以daemon方式运行(-d参数)
$ su - svn -c "svnserve -r /opt/svn -d"
创建版本库
$ mkdir -p /opt/svn/puppet/test
$ svnadmin create /opt/svn/puppet/test
配置SVN
$ vi /opt/svn/puppet/test/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
$ vi /opt/svn/puppet/test/conf/passwd
[users]
test = test123
备份SVN
压缩备份
$ svnadmin dump /opt/svn/repository | gzip > ~/repository-backup.gz
不压缩备份
$ svnadmin dump /opt/svn/repository > ~/repository-backup.svn
检查SVN备份
建立新的svn存储库
$ svnadmin create /opt/svn/newrepository
确认备份成功与否
$ ls -l /opt/svn/newrepository
恢复SVN备份
导入存储库数据
$ svnadmin load /opt/svn/newrepository < ~/repository-backup.svn
权限分配
权限分配细化到每个版本库会有相应的用户容许读写或者只读权限,刚开始纠结很久就是不知道这么多版本库怎么划分,后来查阅网上资料才有一点眉目,所以第一阶段按以下结构划分版本库的权限:
例如:
1、版本库repository1内有三个目录,分别是project1、project2、project3
2、user1、user2为开发者,对project1有读写权限,其他用户只有只读权限
3、user3、user4为开发者,对project2有读写权限,其他用户只有只读权限
4、user5为开发者,对project3有读写权限,其他用户只有只读权限
5、领导为admin,对所有项目拥有读写权限(我觉得这样很不合理,不是开发者不应该拥有读写权限)
那么相应配置文件内容如下:
authz文件内容:
[groups]
devgroup1=user1,user2
devgroup2=user3,user4
devgroup3=user5
[repository1:/project1]
@devgroup1=rw
admin=rw
*=r
[repository1:/project2]
@devgroup2=rw
admin=rw
*=r
[repository1:/project3]
@devgroup3=rw
admin=rw
*=r
password文件内容:
[users]
admin=admin
user1=user1
user2=user2
user3=user3
user4=user4
user5=user5
报错:
1、无法连接主机“xx.xx.xx.xx”: 套接字操作尝试一个无法连接的主机
原因是防火墙阻止了本机访问svn服务器端的监听端口,关闭或者修改防火墙,telnet测试没问题后即可解决。
2、svnserve.conf:12: Option expected
原因是配置文件内不能在每行开头不能有空格,否则报错
3、Repository UUID "xxx(old)" doesn't match expected
UUID "xxx(new)"
原因是备份前和备份后的UUID不同导致,通过修改UUID解决
查看UUID
$ svnlook uuid /opt/svn/puppet/test/
修改UUID
$ svnadmin setuuid /opt/svn/puppet/test "xxx(new)"
查看是否已更新
$ svnlook uuid /opt/svn/puppet/test/
删除数据
删除文件内的文件,选择revert,然后选择需要删除的文件(文件后面是miss的一定要选中),选中后确认,在点击文件夹选择commit,选择所有文件后确认,此时需要删除的文件彻底被删除。
4、导入备份文件的时候出现类似报错
$ svnadmin load /svn_data/zboss/activiti/ < /tmp/4809.dump
<<< Started new transaction, based on original revision 4809
svnadmin: File not found: transaction '5455-1', path 'trunk/OssFront/WebRoot/js/controls/Ext.ux.plugins.RemoteValidator.jsi11'
* editing path : trunk/OssFront/WebRoot/js/controls/Ext.ux.plugins.RemoteValidator.jsi11 ...
$ vi /tmp/4809.dump
Node-path: trunk/OssFront/WebRoot/js/controls/Ext.ux.plugins.RemoteValidator.jsi11
Node-kind: file
Node-action: change
Text-content-length: 3906
Text-content-md5: 95597b45c4bd5c7c34791daef0b0780a
Content-length: 3906
原版本库内没有trunk/OssFront/WebRoot/js/controls/Ext.ux.plugins.RemoteValidator.jsi11文件,而备份文件说明是修改这个文件,所以产生报错,所以将Node-action改成add,既添加该文件即可,再重新执行备份就可以正常进行了。
阅读(1989) | 评论(0) | 转发(0) |