#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#关闭SELINUX
setenforce 0
#永久关闭
vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #将这里的enforcing 改为 disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
yum install -y httpd subversion mod_dav_svn php
cd /etc/httpd/conf.modules.d/
vim 10-subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule dontdothat_module modules/mod_dontdothat.so
<Location /svn>
DAV svn
#代码仓库的父目录
SVNParentPath /home/svn.data
AuthType Basic
AuthName 'svn_auth'
#定义用户文件位置
AuthUserFile /home/svn.data/svnconfig/passwdfile
#定义验证文件位置
AuthzSVNAccessFile /home/svn.data/svnconfig/accessfile
Require valid-user
Satisfy Any
</Location>
mkdir /home/svn.data/{svn,svnconfig} -pv
touch /home/svn.data/svnconfig/{accessfile,passwdfile}
wget http://sourceforge.net/projects/ifsvnadmin/files/svnadmin-1.6.2.zip
unzip svnadmin-1.6.2.zip
mv iF.SVNAdmin-stable-1.6.2/ /var/www/html/svnadmin
chmod 777 -R /var/www/html/svnadmin/data/
chown -R apache:apache /var/www/html/svnadmin/
chmod -R 777 /home/svn.data/
systemctl start httpd
进入svnadmin/data目录,进入config.ini文件
RepositoryDeleteEnabled=true
RepositoryDumpEnabled=true
使用dump进行备份
svnadmin dump /data/svn/idc-self-service/ > svn-idc-self-service-20210608.dump
新建空代码库后使用load进行导入
svnadmin load /extusr/svn/idc-self-service < /extusr/software/svn-idc-self-service-20210608.dump
为数据目录增加apache用户权限
chown -Rvf apache /home/svn.data/
在备份服务器新建相同的svnserver,新建空的备库,进入该库的hooks目录下
cd /data/svn_data/test_bak/hooks/
#拷贝pre-revprop-change.tmpl文件
cp pre-revprop-change.tmpl pre-revprop-change
#将复制的pre-revprop-change文件最后一行
#exit 1 改为 exit 0
vim pre-revprop-change
#增加执行权限
chmod 755 pre-revprop-change
#选择需要同步的svn库,进行初始化同步,时间会比较长
svnsync init file:///home/svn.data/test_bak/ http://10.10.10.10/svn/test
#初始化完成默认同步到当前最新版本,以后定时执行同步命令进行同步
svnsync sync file:///home/svn.data/test_bak/