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…...
Vim 调用外部命令学习笔记
Vim 外部命令集成完全指南 文章目录 Vim 外部命令集成完全指南核心概念理解命令语法解析语法对比 常用外部命令详解文本排序与去重文本筛选与搜索高级 grep 搜索技巧文本替换与编辑字符处理高级文本处理编程语言处理其他实用命令 范围操作示例指定行范围处理复合命令示例 实用技…...
零门槛NAS搭建:WinNAS如何让普通电脑秒变私有云?
一、核心优势:专为Windows用户设计的极简NAS WinNAS由深圳耘想存储科技开发,是一款收费低廉但功能全面的Windows NAS工具,主打“无学习成本部署” 。与其他NAS软件相比,其优势在于: 无需硬件改造:将任意W…...
电脑插入多块移动硬盘后经常出现卡顿和蓝屏
当电脑在插入多块移动硬盘后频繁出现卡顿和蓝屏问题时,可能涉及硬件资源冲突、驱动兼容性、供电不足或系统设置等多方面原因。以下是逐步排查和解决方案: 1. 检查电源供电问题 问题原因:多块移动硬盘同时运行可能导致USB接口供电不足&#x…...
vue3 定时器-定义全局方法 vue+ts
1.创建ts文件 路径:src/utils/timer.ts 完整代码: import { onUnmounted } from vuetype TimerCallback (...args: any[]) > voidexport function useGlobalTimer() {const timers: Map<number, NodeJS.Timeout> new Map()// 创建定时器con…...
C# 类和继承(抽象类)
抽象类 抽象类是指设计为被继承的类。抽象类只能被用作其他类的基类。 不能创建抽象类的实例。抽象类使用abstract修饰符声明。 抽象类可以包含抽象成员或普通的非抽象成员。抽象类的成员可以是抽象成员和普通带 实现的成员的任意组合。抽象类自己可以派生自另一个抽象类。例…...
Python 包管理器 uv 介绍
Python 包管理器 uv 全面介绍 uv 是由 Astral(热门工具 Ruff 的开发者)推出的下一代高性能 Python 包管理器和构建工具,用 Rust 编写。它旨在解决传统工具(如 pip、virtualenv、pip-tools)的性能瓶颈,同时…...
【Java学习笔记】BigInteger 和 BigDecimal 类
BigInteger 和 BigDecimal 类 二者共有的常见方法 方法功能add加subtract减multiply乘divide除 注意点:传参类型必须是类对象 一、BigInteger 1. 作用:适合保存比较大的整型数 2. 使用说明 创建BigInteger对象 传入字符串 3. 代码示例 import j…...
Mysql中select查询语句的执行过程
目录 1、介绍 1.1、组件介绍 1.2、Sql执行顺序 2、执行流程 2.1. 连接与认证 2.2. 查询缓存 2.3. 语法解析(Parser) 2.4、执行sql 1. 预处理(Preprocessor) 2. 查询优化器(Optimizer) 3. 执行器…...
Caliper 负载(Workload)详细解析
Caliper 负载(Workload)详细解析 负载(Workload)是 Caliper 性能测试的核心部分,它定义了测试期间要执行的具体合约调用行为和交易模式。下面我将全面深入地讲解负载的各个方面。 一、负载模块基本结构 一个典型的负载模块(如 workload.js)包含以下基本结构: use strict;/…...
《Docker》架构
文章目录 架构模式单机架构应用数据分离架构应用服务器集群架构读写分离/主从分离架构冷热分离架构垂直分库架构微服务架构容器编排架构什么是容器,docker,镜像,k8s 架构模式 单机架构 单机架构其实就是应用服务器和单机服务器都部署在同一…...
