1、先查看是否存在svn,没有就需要安装svn
svnserve --version #查看svn版本号
which svn #查看svn程序所在目录
yum install subversion -y #安装svn
systemctl cat svnserve.service #查看系统配置文件
2、修改svn全局配置文件中指向的目录
3、创建svn版本库
sudo svnadmin create /opt/svn/topevery
4、修改authz、passwd、 svnserve.conf三个文件建立用户组、用户、目录权限
authz
[groups]
manager=wilson
dev=wilson01 [/]
@manager=rw
[/UI]
@dev]
passwd
[users]
# harry = harryssecret
# sally = sallyssecret
wilson=
wilson01=
svnserve.conf
[general] anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = topevery
[sasl]
5、编辑服务配置文件
在 /etc/init.d 目录下,创建脚本 svnd
touch svnd
chmod u+x svnd
svnd文件内容如下
#!/bin/sh
# chkconfig:
# description: svn server
SVN_HOME=/opt/svn/topevery
if [ ! -f "/usr/bin/svnserve" ]
then
echo "svnserver startup: cannot start"
exit
fi
case "$1" in
start)
echo "Starting svnserve…"
/usr/bin/svnserve -d --listen-port -r $SVN_HOME
echo "Finished!"
;;
stop)
echo "Stoping svnserve…"
killall svnserve
echo "Finished!"
;;
restart)
$ stop
$ start ;;
*)
echo "Usage: svn { start | stop | restart } "
exit
esac
svnd
启动svn
service svnd start
6、开放防火墙端口
firewall-cmd --zone=public --add-port=/tcp --permanent firewall-cmd --reload
netstat -ln | grep 3690
ps aux|grep svnserve
7、设置svn服务为自启动
chkconfig --add svnd
chkconfig svnd on
遇到的问题及解决方法
1、Can't open file '/opt/svn/topevery/db/txn-current-lock': Permission denied
关闭SELinux
[root@localhost ~]# getenforce
Enforcing [root@localhost ~]# vim /etc/selinux/config 将SELINUX=enforcing改为SELINUX=disabled,保存后退出
2、