阿里云 centos 7 安装 svn 服务器

一、SVN 服务端搭建

1、安装 svn

sudo yum install subversion

2 查看版本

svnserve --version

输出:

svnserve, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

2、创建版本库目录

sudo mkdir -p  /home/svn
sudo chmod -R 777 /home/svn
cd /home/svn
mkdir mcu

3,创建版本库

cd  /home/svn/mcu
svnadmin create /home/svn/mcu/Atmege32U4_SparkFun_Breakout

cd Atmege32U4_SparkFun_Breakout/

4, 配置版本库

cd  /home/svn/mcu/Atmege32U4_SparkFun_Breakout/conf/
修改文件:svnserve.conf

这里写图片描述

修改文件:authz

这里写图片描述

修改文件:passwd

这里写图片描述

5,设置阿里云的SVN 服务器端口 3690

SVN的默认端口是3690
其实是要设置阿里云服务器 ECS 中实例的“本实例安全组”才行

1、进入ECS控制台:https://ecs.console.aliyun.com/
2、先找到我们购买的实例,然后在左侧栏找到“网络和安全”—“安全组”,如下图:

这里写图片描述

点击“配置规则”

这里写图片描述
3、点击“添加安全组规则”,
这里写图片描述
添加3690号端口
这里写图片描述

6 centos7 重启 SVN 服务器:

ps -ef |grep svn
sudo ps aux |grep 'svn'
sudo killall svnserve
sudo svnserve -d -r /home/svn

7,win7 连接 SVN 服务器:

TortoiseSVN 1.9.3, Build 27038 - 64 Bit

svn://118.xxx.xxx.19/mcu/Atmege32U4_SparkFun_Breakout/

补充:

3.下面要修改这个目录下的三个配置文件(键值后面对不能有空格)
//进入刚刚创建的版本仓库目录
cd /svn/repos/first
//配置版本库信息和用户文件和用户密码文件的路径、版本库路径
vi svnserve.conf 
//把
# anon-access = read
# auth-access = write
# password-db = passwd
//这四行,前面的#号和空格去掉
//改成none
anon-access = none
auth-access = write
password-db = passwd
//改成自己的版本库
realm = first
//保存退出

(2)vi authz     //文件,创建svn组和组用户的权限

[groups]
 //创建一个first的组,并制定两个用户ddl和shl
first = ddl,shl
//制定根目录下的权限
[/]
//first组用户权限为读写
@first = rw
//其他用户只有读权限
* = r

//保存退出

(3) vi passwd   //创建或修改用户密码

[users]
//用户名为gep的用户的密码为123456
ddl = 123456
//。。。
shl = 123456

//保存退出
设置自启动

vi /etc/rc.local
打开自启动文件, 文件内容如下

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
// 添加下面一行
svnserve -d -r /usr/local/svnRepo/first
//保存退出

SVN版本库起动方式,现在svnRepo下面有 first、test 两个版本库
1:单版本库起动

 svnserve -d -r /usr/local/repos/first

多版本库起动

svnserve -d -r /usr/local/repos

区别在于起动svn时候的命令中的启动参数-r指定的目录。

限制不同的用户对不同的版本库操作权限,修改版本库中的conf目录下的 authz文件(键值后面对不能有空格)

以配置 first 版本库为例

vi authz


[groups]

company = user1,user2

[first:/]             //指定版本库跟目录下的权限

@company = rw     //company组用户权限为读写

* = r           //其他用户只有读权限
//保存退出



vi passwd //设置组中用户的账号和密码

[users]

user1  = 123456

user2 = 123456

参考:
阿里云centos7搭建svn服务器
https://blog.csdn.net/djx5344/article/details/78598025

猜你喜欢

转载自blog.csdn.net/wowocpp/article/details/80953353