svn安装备份恢复授权

 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

1.安装apache
tar zxvf httpd-2.4.2.tar.gz
cd httpd-2.4.2
./configure -prefix=/opt/apache -with-mpm=worker -enable-mods-shared=all -enable-proxy=shared -enable-proxy-balancer=shared -enable-proxy-http=shared -enable-proxy-ajp -enable-deflate -enable-cache -enable-file-cache -enable-disk-cache -enable-mem-cache -enable-nonportable-atomics -enable-mods-shared=most -enable-dav -enable-dav-lock -enable-maintainer-mode  -enable-dav-fs -enable-rewrite -enable-so
make
make install
 
注意:apache中添加配置段
 
</IfModule>
<Location /svn/>
DAV svn
SVNListParentPath on
SVNParentPath /opt/svn/
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /opt/svn/passwd.conf
AuthzSVNAccessFile /opt/svn/authz
Require valid-user
</Location>
 
2.安装subversion
wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.15.tar.gz
wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
 
tar zxvf neon-0.29.6.tar.gz
cd neon-0.29.6
./configure --prefix=/usr/local/neon
make
make install
 
 
wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.15.tar.gz
两者同时解压两个文件内容会全部放到subversion-1.6.15中
cd subversion-1.6.15
./configure --with-apxs=/usr/local/apache/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apache --with-apr-util=/usr/local/apache --with-ssl --with-neon=/usr/local/neon --enable-maintainer-mode
make
make install 
3.新建仓库目录和对应项目名称
mkdir /opt/svn
svnadmin create test
svn import /var/www/file/ file:///opt/svn/test/file -m "test"(导入文件)
4.svn备份和恢复
a.hotcopy备份还原
svnadmin hotcopy /opt/svn/test/  /home/backup/test  --clean-logs
svnadmin hotcopy /home/backup/test /opt/svn/test
 
dump的备份和恢复
svnadmin dump /opt/svn/test/ >/home/backup/testfull.dump(全局备份)
svnadmin dump /opt/svn/test/ -r2 --incremental>/home/backup/test.2.bak(增量备份)
 
svnadmin load /opt/svn/test/ </home/backup/testfull.dump
svnadmin load /opt/svn/test/</home/backup/test.2.bak
 
5.svn 中如何创建账号,授予权限
a.创建授权文件和密码文件
touch /opt/svn/passwd.conf
touch /opt/svn/authz
 
/opt/apache/bin/htpasswd -c /opt/svn/passwd.conf test
 
vi /opt/svn/authz
[group]
admin_group=admin1,admin2
 
[/]
@admin_group = rw
 
[test:/]
test = rw
 
[test:/it]
test = rw
 
 
赋予权限过后需要重启动APACHE
 
http://localhost/svn/(看到所有子项目)
 
 
 
6.SVN 常用命令
svn co --username --password http://usl  path
cd path
svn update
svn commit -m "modify"
 
7.svn info 可以查看SVN相应的信息
 
8.svn merge -r rHEAD:109 http://example.com/repository/trunk/src
从当前最新版本回退到109,待回退的分支为http://example.com/repository/trunk/src