阿里云CentOS7安装svn服务器

创建版本库目录

cd usr/local

mkdir -p svn/svndata

安装svn

yum -y install subversion

查看svn版本

svnserve --version

创建版本库

svnadmin create /usr/local/svn/svndata

进入svn版本库目录

cd /usr/local/svn/svndata/conf

可以看到在conf下有三个文件

修改版本库配置文件

vim svnserve.conf

anon-access = none(匿名用户不可访问)
auth-access = write(认证用户可以执行写操作)
password-db = passwd(密码文件)
authz-db = authz(认证文件)
realm = /usr/local/svn/svndata(认证空间名,版本库所在目录)

修改权限文件

vim authz

admin = tengjs,gy用户组包含tengjs和gy两个用户

@admin = rw用户组中包含的所有用户都有读写权限

密码配置

vim passwd

设置防火墙允许访问3690端口 

cd /etc/sysconfig

vim iptables

重启防火墙

cd etc/rc.d/init.d

service iptables restart

启动svn

svnserve -d -r /usr/local/svn

查看svn进程

ps -ef|grep svn|grep -v grep

检测svn端口

netstat -ln|grep 3690

停止svn

killall svnserve

设置svn开机启动

复制启动脚本到资源目录

cp zookeeper svnserver

注意我的资源目录下有一个zookeeper的启动脚本,你可以从其他地方拷贝

编辑svnserver启动脚本

vim svnserver

加入如下内容:

#!/bin/bash
#chkconfig:2345 20 90
#description:svnserver    
#processname:svnserver
/usr/bin/svnserve -d -r /usr/local/svn

这里的svnserve路径写绝对路径

绝对路径用which svnserve命令查找

增加svnserver服务控制脚本执行权限

chmod +x svnserver

将svnserver服务加入到系统服务

chkconfig --add svnserver

检查svnserver服务是否已经生效

chkconfig --list svnserver

ok,配置完成,服务器开机后就能自动启动了

猜你喜欢

转载自blog.csdn.net/tjsahwj/article/details/81384547