Ubuntu:部署SVN服务器!

Introductions

网上svn的介绍很多了!我的理解就是版本控制软件,适用于协同工作!
比如多人一起开发一个功能或者多人写同一个文档,那么可以先从svn服务器上拉(pull)最新的版本,然后分别进行修改,改完之后再推(pull)到svn服务器上,这样就可以保证svn服务器上的东西是最新版本,然后每次更改都先拉一下最新版本,这样的好处就是本地电脑上就不会有xxxv1、xxxv2、xxx最终版这种文件的出现,同时在与别人分享文件的时候可以直接从服务器上拉内容资料,全且方便!
但是像git也能做这种事情,但是一般来讲git用的比较多的还是命令行模式,可能对新手不太友好,虽然git也有gui版本!有兴趣的也可以自行摸索!
我是最近团队里写了很多很多很多文档PPT,然后来来回回改,导致电脑上出现了非常多的版本,就想着搞一个svn来试试!

Method

这里随便用一个厂商的云服务器!Ubuntu20.04!

1. 安装subversion
apt install subversion
# 读条结束后可运行代码看是否安装成功
svnserve --version
2. 创建svn版本库
# 在合适的地方创一个svn文件夹,我这里创建在/home下
mkdir /home/svn
# 创建svn仓库
svnadmin create /home/svn/repo
# 创建完成之后cd到 /home/svn/repo
cd /home/svn/repo
ls
# 可以看到下面的结构
# conf  db  format  hooks  locks  README.txt
3. 修改配置文件以及增加用户 权限
# 进入配置文件
cd conf
# 可以看到内容
# authz  hooks-env.tmpl  passwd  svnserve.conf
# 其中svnserve.conf就是配置文件
vim svnserve.conf

里面有很多内容,这里就显示一部分

  • anon-access:控制非鉴权用户访问版本库的权限(来自菜鸟驿站的术语)我的理解就是非用户能做的事(手动狗头; 填none应该就ok
  • auth-access:控制鉴权用户访问版本库的权限
  • password-db: 配置用户名密码的地方,默认的话就是当前文件夹下的passwd
  • authz-db: 配置用户权限的地方, 默认的话就是当前文件夹下的authz

这里是取消这四个字段的注释

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
........
authz-db = authz

这里改掉之后就去增加用户了

vim passwd
[users]
# harry = harryssecret
# sally = sallyssecret
# 格式:
# 用户名 = 密码
user1 = 123
user2 = 123

增加权限

vim authz
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# 这个部分的格式是:
# 组 = 用户(如果有多个用户就用逗号隔开
user = user1, user2 # user这个组拥有两个用户

# 这个先不说 有点只可意会的感觉hhh
# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
# 这里格式是:
# [版本库名:路径]
# 如果针对组加权限就是 @组名 = 权限(r,w)
# 如果是针对个人就直接 用户 = 权限
# * = 的意思就是哪怕是没有设置,所有组都具备的权限
[repo:/] #repo这个版本库包括所有的文件
@user = r #user组拥有读权限
user1 = rw #user1这个用户拥有读写权限
* = #没设置的组无权限
4. 启动服务
svnserve -d -r 目录 --listen-port 端口号
  • -d 是后台运行
  • -r 是指定目录,这里会包含两种访问方式,这里详细可以参考一下菜鸟教程
  • –listen-port是指定端口号,默认是3690

所以这里就直接

svnserve -d -r /home/svn

这样就启动好了。
客户端就可以访问这个svn服务器了

Last

客户端的使用可以参考菜鸟教程 !然后svn也还有一些其他的配置项还需要摸索!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值