ubuntu安装配置svn
目录
- 简介
- 安装
- SVN 启动模式
- 方式1:单库svnserve方式
- 方式2:多库svnserve方式
- SVN 创建版本库
- 1.svn 服务配置文件 svnserve.conf
- 2.用户名口令文件 passwd
- 3.权限配置文件
- 4.多库方式运行
- SVN 检出操作
- SVN 解决冲突
- SVN 提交操作
- SVN 版本回退
- SVN 查看历史信息
- 1.svn log
- 2.svn diff
- 3.svn cat
- 4.svn list
- SVN分支
- SVN 标签(tag)
- authentication realm
- Cyrus SASL authentication
- Implementing Repository Hooks
- 密码生成器
- 相关链接
简介
svn可以检出单个文件,git不具备这个特点,大多数公司使用svn服务器作为文档管理,二进制镜像,可执行文件等发布用途.
主要参考https://svnbook.red-bean.com/这本书.
安装
#安装
sudo apt install subversion
#查看是否安装
svn --version
SVN 启动模式
#手动新建版本库目录
sudo mkdir -p /data/svn#利用svn命令创建版本库
svnadmin create /data/svn/company#使用命令svnserve启动服务
svnserve -d -r /data/svn/company --listen-port 3690
#-r: 配置方式决定了版本库访问方式
#--listen-port: 指定SVN监听端口,不加此参数,SVN默认监听3690#由于-r 配置方式的不一样,SVN启动就可以有两种不同的访问方式
方式1:单库svnserve方式
-r直接指定到版本库(称之为单库svnserve方式)
svnserve -d -r /data/svn/company
在这种情况下,一个svnserve只能为一个版本库工作。
authz配置文件中对版本库权限的配置应这样写:
[groups]
admin=user1
dev=user2
[/]
@admin=rw
user2=r
使用类似这样的URL:svn://192.168.0.1/ 即可访问runoob版本库
方式2:多库svnserve方式
指定到版本库的上级目录
svnserve -d -r /data/svn
这种情况,一个svnserve可以为多个版本库工作
authz配置文件中对版本库权限的配置应这样写:
[groups]
admin=user1
dev=user2
[runoob:/]
@admin=rw
user2=r[runoob01:/]
@admin=rw
user2=r
如果此时你还用[/],则表示所有库的根目录,同理,[/src]表示所有库的根目录下的src目录。
使用类似这样的URL:svn://192.168.0.1/company 即可访问company版本库。
SVN 创建版本库
使用 svn 命令创建资源库:
svnadmin create /data/svn/company
tree /data/svn/company/conf/
/data/svn/company/conf/
├── authz
├── hooks-env.tmpl
├── passwd
└── svnserve.conf
1.svn 服务配置文件 svnserve.conf
该文件仅由一个 [general] 配置段组成, 此文件已经复制出来,可以查看阅读.
主要选项说明如下:
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = tiku
### 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### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the
### directory containing this file. The specified path may be a
### repository relative URL (^/) or an absolute file:// URL to a text
### file in a Subversion repository. If you don't specify an authz-db,
### no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz### The groups-db option controls the location of the file with the
### group definitions and allows maintaining groups separately from the
### authorization rules. The groups-db file is of the same format as the
### authz-db file and should contain a single [groups] section with the
### group definitions. If the option is enabled, the authz-db file cannot
### contain a [groups] section. Unless you specify a path starting with
### a /, the file's location is relative to the directory containing this
### file. The specified path may be a repository relative URL (^/) or an
### absolute file:// URL to a text file in a Subversion repository.
### This option is not being used by default.
# groups-db = groups### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
realm = jw### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above. Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none### The hooks-env options specifies a path to the hook script environment
### configuration file. This option overrides the per-repository default
### and can be used to configure the hook script environment for multiple
### repositories in a single file, if an absolute path is specified.
### Unless you specify an absolute path, the file's location is relative
### to the directory containing this file.
# hooks-env = hooks-env[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### Enabling this option requires svnserve to have been built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
use-sasl = false### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
2.用户名口令文件 passwd
用户名口令文件由 svnserve.conf 的配置项 password-db 指定,默认为 conf 目录中的 passwd。该文件仅由一个 [users] 配置段组成。
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.[users]
# harry = harryssecret
username = 123456
3.权限配置文件
权限配置文件由 svnserve.conf 的配置项 authz-db 指定,默认为 conf 目录中的 authz。该配置文件由一个 [groups] 配置段和若干个版本库路径权限段组成。
[groups]配置段中配置行格式如下:
<用户组> = <用户列表>
版本库路径权限段的段名格式如下:
[<版本库名>:<路径>]
例子
[groups]
g_admin = admin,thinker[admintools:/]
@g_admin = rw
* =[test:/home/thinker]
thinker = rw
* = r
在版本库目录下/data/svn/company/conf, 默认内容:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = username# [/foo/bar]
# harry = rw
# &joe = r
# * =# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[company:/]
@admin = rw
$authenticated =rw
4.多库方式运行
svnserve -d -r /data/svn
#访问地址
svn://106.15.109.116/company
SVN 检出操作
svn checkout svn://106.15.109.116/company --username=username
SVN 解决冲突
svn update
svn update -r6
#edit
svn commit -m "change HelloWorld.html second"
SVN 提交操作
svn status
svn add readme
svn status
svn commit -m "SVN readme."
#edit
svn commit
SVN 版本回退
#edit
svn status
svn revert readme.md
#目录
svn revert -R trunk
但是,假如我们想恢复一个已经提交的版本怎么办。
为了消除一个旧版本,我们必须撤销旧版本里的所有更改然后提交一个新版本。这种操作叫做 reverse merge。
首先,找到仓库的当前版本,现在是版本 22,我们要撤销回之前的版本,比如版本 21。
svn merge -r 22:21 readme
SVN 查看历史信息
1.svn log
用来展示svn 的版本作者、日期、路径等等
#查看特定的某两个版本之间的信息
svn log -r 6:8
#查看某一个文件的版本修改信息
svn log trunk/HelloWorld.html
#如果希望得到目录的信息要加 -v
#如果希望显示限定N条记录的目录信息,使用 svn log -l N -v
2.svn diff
用来显示特定修改的行级详细信息。
- 检查本地修改
- 比较工作拷贝与版本库
- 比较版本库与版本库
#如果用 svn diff,不带任何参数,它将会比较你的工作文件与缓存在 .svn 的"原始"拷贝
svn diff#比较工作拷贝和版本库
svn diff -r 3 rule.txt#比较版本库与版本库
svn diff -r 2:3 rule.txt
3.svn cat
取得在特定版本的某文件显示在当前屏幕。
#如果只是希望检查一个过去版本,不希望查看他们的区别,可使用svn cat
svn cat -r 版本号 rule.txt
4.svn list
显示一个目录或某一版本存在的文件
#svn list 可以在不下载文件到本地目录的情况下来察看目录中的文件:
svn list svn://106.15.109.116/company
SVN分支
#新建一个分支
svn copy trunk/ branches/my_branch
#提交新增的分支到版本库
svn commit -m "add my_branch"
#到 my_branch 分支进行开发
cd branches/my_branch/
#切换到 trunk,执行 svn update,然后将 my_branch 分支合并到 trunk 中
svn merge ../branches/my_branch/
#将合并好的 trunk 提交到版本库中。
svn commit -m "add index.html"
SVN 标签(tag)
#创建标签
svn copy trunk/ tags/v1.0
#提交标签
svn commit -m "tags v1.0"
authentication realm
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
假如要共享密码库文件,authentication realm必须相同
Cyrus SASL authentication
需要的时间太多,暂时不用
svn.conf
in the directory where SASL plug-ins are located
/usr/lib/sasl2/
/etc/sasl2//usr/lib/sasl2
/usr/lib/x86_64-linux-gnu/sasl2
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: /etc/my_sasldb
mech_list: DIGEST-MD5
saslpasswd2 -c -f /etc/my_sasldb -u realm username
Implementing Repository Hooks
实现提交必须听有注释
hooks/pre-commit
REPOS="$1"
TXN="$2"# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log -t $TXN $REPOS | wc -m`#echo $LOGMSG > /data/svn/company/hooks/test.txt
#一个汉字对应8个字符
if [ "$LOGMSG" -lt 16 ];thenecho "\n提交失败:至少输入2个汉字或16个英语字母数字" 1>&2 exit 1
fi# Exit on all errors.
set -e# All checks passed, so allow the commit.
exit 0
密码生成器
由于使用内建的认证方式,用户不能修改密码,增加用户时请找管理员.管理员可以使用密码生成器一次生成多个密码.
sudo apt install pwgen
pwgen
相关链接
SVN 教程
SVN 官网
Github SVN 源码
Linux服务器搭建SVN服务
sasl认证
相关文章:
ubuntu安装配置svn
目录 简介安装SVN 启动模式方式1:单库svnserve方式方式2:多库svnserve方式 SVN 创建版本库1.svn 服务配置文件 svnserve.conf2.用户名口令文件 passwd3.权限配置文件4.多库方式运行 SVN 检出操作SVN 解决冲突SVN 提交操作SVN 版本回退SVN 查看历史信息1.svn log2.svn diff3.svn…...
『Jmeter入门万字长文』 | 从环境搭建、脚本设计、执行步骤到生成监控报告完整过程
『Jmeter入门万字长文』 | 从环境搭建、脚本设计、执行步骤到生成监控报告完整过程 1 Jmeter安装1.1 下载安装1.2 Jmeter汉化1.2.1 临时修改1.2.2 永久修改 1.3 验证环境 2 测试对象2.1 测试对象说明2.2 测试对象安装2.2.1 下载安装2.2.2 启动测试对象服务2.2.3 访问测试对象2.…...
Unity C#中LuaTable、LuaArrayTable、LuaDictTable中数据的增删改查
LuaTable、LuaArrayTable、LuaDictTable中数据的增删改查 介绍Lua表lua表初始化lua移除引用lua中向表中添加数据lua中表中移除数据lua表中连接数据lua表中数据排序获取lua表长度获取表中最大值 UnityC#中LuaTableUnityC#中LuaArrayTable、LuaDictTable、LuaDictTable<K,V>…...
Spring常见面试题
https://blog.csdn.net/a745233700/article/details/80959716?ops_request_misc%257B%2522request%255Fid%2522%253A%2522169847982516800213061720%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id169847982516800213061720&biz_id0&…...
通过Vue自带服务器实现Ajax请求跨域(vue-cli)
通过Vue自带服务器实现Ajax请求跨域(vue-cli) 跨域 原理:从A页面访问到B页面,并且要获取到B页面上的数据,而两个页面所在的端口、协议和域名中哪怕有一个不对等,那么这种行为就叫跨域。注意:类…...
Vue2-计算属性的用法
题记 vue2计算属性的用法 反转字符串 <!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>实例</title> <script src"https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script> </hea…...
SM3加密udf
SM3加密udf maven xml <dependencies> <!-- 配置日志 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dep…...
ce从初阶到大牛(两台主机免密登录)
一、配置ssh远程连接 实现两台linux主机之间通过公钥验证能够互相实现免密登陆 1.确认服务程序是否安装 rpm -qa | grep ssh 2.是否启动 ps -aux | grep ssh 3.生成非对称公钥 ssh-keygen -t rsa 4.公钥发送到客户端 cd /root/.ssh/ ssh-copy-id root192.168.170.134 因为…...
CS224W2.3——传统基于特征的方法(图层级特征)
前两篇中我们讨论了节点层级的特征表示、边层级的特征表示: CS224W2.1——传统基于特征的方法(节点层级特征)CS224W2.2——传统基于特征的方法(边层级特征) 在这篇中,我们将重点从整个图中提取特征。换句话说,我们想要描述整个图结构的特征…...
【CSS】包含块
CSS规范中的包含块 包含块的内容: 元素的尺寸和位置,会受它的包含块所影响。 对于一些属性,例如 width, height, padding, margin,绝对定位元素的偏移值(比如 position 被设置为 absolute 或 fixed)&…...
[SpringCloud] Nacos 简介
目录 一、Nacos,启动! 1、安装 Nacos 2、运行 Nacos 3、Nacos 服务注册 二、Nacos 服务多级存储模型 1、服务跨集群分配 2、NacosRule 负载均衡(优先本地) 3、服务实例的权重设置 4、环境隔离 三、Nacos 注册中心细节分…...
TypeScript - 字符串的字面类型
啥是字面量类型 字面量类型,是限制了一个字符串变量的取值范围只能某几个固定字符串中的一个。 我感觉 与枚举类型有异曲同工之妙。 字符串字面量类型有啥用 没啥用。 就是来限制字符串变量不能随便赋值的。 定义一个我看看 让你读书,但是只有四本书可以…...
CRM客户管理系统源码 带移动端APP+H5+小程序
CRM客户管理系统源码 带移动端APPH5小程序 开发环境: thinkphp mysql 功能介绍: 1、 办公管理:审批管理、工作报告、日程管理、办公审批、公告管理 2、 客户管理:我的客户、客户列表、成交客户、行业类别、预查、地区列表、客户状态、客…...
Mac版好用的Git客户端 Fork 免激活
Fork是一款强大的Git客户端软件,在Mac和Windows操作系统上都可以使用。汇集了众多先进的功能和工具,可以帮助用户更方便地管理和控制Git仓库。 Fork的界面简洁直观,易于使用。它提供了许多高级的Git功能,如分支管理、合并、提交、…...
有一个带头结点的单链表L,设计一个算法使其元素递增有序
有一个带头结点的单链表L,设计一个算法使其元素递增有序 代码思路: 我这里懒得搞那个指针了,直接遍历一遍链表,把链表的元素复制到数组arr里面 对数组A进行一下排序,排完之后再把元素复制到L里面。 至于排序你用啥算…...
JAVA将EEE MMM dd HH:mm:ss zzz yyyy日期格式化为yyyy-MM-dd HH:mm:ss形式
1、将EEE MMM dd HH:mm:ss zzz yyyy格式的数据转换成yyyy-MM-dd HH:mm:ss 代码如下 public static void main(String[] args) throws ParseException {String dateStr "Mon Oct 26 15:19:15 CST 2020";DateFormat cstFormate new SimpleDateFormat("yyyy-MM…...
【Qt】文件系统
文章目录 文件系统文件操作案例:显示路径到标题框,显示内容到文本框对文件进行写操作获取文件相关信息 文件系统 Qt 通过QIODevice提供了对 I/O 设备的抽象,这些设备具有读写字节块的能力,下面是 I/O 设备的类图: QIO…...
PostgreSQL 基础知识
执行环境: psql 1. 创建一个表格 CREATE TABLE customers ( customer_id serial PRIMARY KEY,firstname VARCHAR(100) NOT NULL,lastname VARCHAR(100) NOT NULL,username VARCHAR(50) UNIQUE NOT NULL,password VARCHAR(50) NOT NULL,email VARCHAR(255) UNIQUE …...
基于 ResNet18 架构使用 deformable convolution的车道线检测
下面是一个基于关键点的车道线检测网络的 PyTorch 代码示例,其中使用了 deformable convolution。该代码示例基于 ResNet18 架构,可以根据实际情况进行修改。 首先,需要导入必要的库和模块: import torch import torch.nn as nn…...
C++in/out输入输出流[IO流]
文章目录 1. C语言的输入与输出2.C的IO流2.1流的概念2.2CIO流2.3刷题常见while(cin >> str)重载强制类型转换运算符模拟while(cin >> str) 2.4C标准IO流2.5C文件IO流1.ifstream 1. C语言的输入与输出 C语言用到最频繁的输入输出方式就是scanf ()与printf()。 scanf…...
Python flask django框架的汽车零件运输管理信息系统设计及实现
目录同行可拿货,招校园代理 ,本人源头供货商功能模块设计技术实现要点高级功能扩展代码示例(Flask)部署与维护项目技术支持源码获取详细视频演示 :文章底部获取博主联系方式!同行可合作同行可拿货,招校园代理 ,本人源头供货商 功…...
Rufus技术转型中的兼容性管理:从Windows 7支持终止看开源项目的演进策略
Rufus技术转型中的兼容性管理:从Windows 7支持终止看开源项目的演进策略 【免费下载链接】rufus The Reliable USB Formatting Utility 项目地址: https://gitcode.com/GitHub_Trending/ru/rufus 技术变革背景:软件生命周期与系统迭代的必然冲突 …...
快马平台十分钟搭建vmware虚拟机web管理原型,告别环境配置烦恼
最近在做一个虚拟化相关的项目,需要快速搭建一个VMware虚拟机管理工具的原型。传统方式需要本地安装各种软件,配置环境特别麻烦。后来发现用InsCode(快马)平台可以十分钟搞定,分享下我的实现过程。 项目规划 首先明确原型需要实现的核心功能&…...
2025最权威的六大降AI率神器横评
Ai论文网站排名(开题报告、文献综述、降aigc率、降重综合对比) TOP1. 千笔AI TOP2. aipasspaper TOP3. 清北论文 TOP4. 豆包 TOP5. kimi TOP6. deepseek 对维普系统而言,在检测AI生成内容之际,它能够凭借多种办法来降低相似…...
新手福音:通过快马平台零代码基础创建你的第一个workbuddy任务管理应用
作为一个刚接触编程的新手,想要自己动手做一个任务管理应用却不知从何下手?最近我发现了一个超友好的工具——InsCode(快马)平台,完全零基础就能做出一个功能完整的workbuddy任务管理器。下面分享我的实践过程,希望能帮到同样想入…...
华为网络设备高危命令大全
在网络运维现场,最怕的不是设备坏,而是“人手滑”。 很多事故不是硬件问题,也不是链路问题,而是一条命令敲下去,业务直接“蒸发”。 我带过不少一线工程师,有个共同问题: 命令会用,但不知道哪些“不能随便用”。 这篇文章,不讲基础、不讲概念,直接把华为网络设备中…...
如何用MaaYuan实现代号鸢游戏自动化:从零开始解放双手的终极指南
如何用MaaYuan实现代号鸢游戏自动化:从零开始解放双手的终极指南 【免费下载链接】MaaYuan 代号鸢 / 如鸢 一键长草小助手 项目地址: https://gitcode.com/gh_mirrors/ma/MaaYuan 厌倦了在《代号鸢》和《如鸢》中重复点击、刷体力、做日常?MaaYua…...
seo优化员如何提高网站的流量
SEO优化员如何提高网站的流量 在当今竞争激烈的互联网环境中,网站的流量直接关系到企业的业务拓展和品牌影响力。对于SEO优化员来说,如何有效提高网站的流量是一个必须面对和解决的问题。本文将从问题分析、原因说明、解决方法、注意事项和实用建议几个…...
为什么sin(A+B)= sin(A)cos(B)+cos(A)sin(B)
### 为什么三角函数的加法和减法公式是这样?(给10岁小孩讲的故事版)嗨,小朋友!我是你的数学小老师。今天我们来聊聊“三角函数”的加法和减法公式,比如 sin(AB) sin A cos B cos A sin B。这些公式听起来…...
解锁欧空局10米土地利用数据:从注册到GIS应用全流程解析
1. 欧空局WorldCover数据简介 第一次接触欧空局10米土地利用数据的朋友可能会问:这到底是什么神仙数据?简单来说,这是目前全球分辨率最高的公开土地利用数据集之一,由哨兵1号和哨兵2号卫星数据融合生成。我去年在做城市扩张研究时…...
