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…...
React 第五十五节 Router 中 useAsyncError的使用详解
前言 useAsyncError 是 React Router v6.4 引入的一个钩子,用于处理异步操作(如数据加载)中的错误。下面我将详细解释其用途并提供代码示例。 一、useAsyncError 用途 处理异步错误:捕获在 loader 或 action 中发生的异步错误替…...
工业自动化时代的精准装配革新:迁移科技3D视觉系统如何重塑机器人定位装配
AI3D视觉的工业赋能者 迁移科技成立于2017年,作为行业领先的3D工业相机及视觉系统供应商,累计完成数亿元融资。其核心技术覆盖硬件设计、算法优化及软件集成,通过稳定、易用、高回报的AI3D视觉系统,为汽车、新能源、金属制造等行…...

SpringTask-03.入门案例
一.入门案例 启动类: package com.sky;import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCach…...

mysql已经安装,但是通过rpm -q 没有找mysql相关的已安装包
文章目录 现象:mysql已经安装,但是通过rpm -q 没有找mysql相关的已安装包遇到 rpm 命令找不到已经安装的 MySQL 包时,可能是因为以下几个原因:1.MySQL 不是通过 RPM 包安装的2.RPM 数据库损坏3.使用了不同的包名或路径4.使用其他包…...
在web-view 加载的本地及远程HTML中调用uniapp的API及网页和vue页面是如何通讯的?
uni-app 中 Web-view 与 Vue 页面的通讯机制详解 一、Web-view 简介 Web-view 是 uni-app 提供的一个重要组件,用于在原生应用中加载 HTML 页面: 支持加载本地 HTML 文件支持加载远程 HTML 页面实现 Web 与原生的双向通讯可用于嵌入第三方网页或 H5 应…...

[大语言模型]在个人电脑上部署ollama 并进行管理,最后配置AI程序开发助手.
ollama官网: 下载 https://ollama.com/ 安装 查看可以使用的模型 https://ollama.com/search 例如 https://ollama.com/library/deepseek-r1/tags # deepseek-r1:7bollama pull deepseek-r1:7b改token数量为409622 16384 ollama命令说明 ollama serve #:…...
第7篇:中间件全链路监控与 SQL 性能分析实践
7.1 章节导读 在构建数据库中间件的过程中,可观测性 和 性能分析 是保障系统稳定性与可维护性的核心能力。 特别是在复杂分布式场景中,必须做到: 🔍 追踪每一条 SQL 的生命周期(从入口到数据库执行)&#…...

Elastic 获得 AWS 教育 ISV 合作伙伴资质,进一步增强教育解决方案产品组合
作者:来自 Elastic Udayasimha Theepireddy (Uday), Brian Bergholm, Marianna Jonsdottir 通过搜索 AI 和云创新推动教育领域的数字化转型。 我们非常高兴地宣布,Elastic 已获得 AWS 教育 ISV 合作伙伴资质。这一重要认证表明,Elastic 作为 …...

Python训练营-Day26-函数专题1:函数定义与参数
题目1:计算圆的面积 任务: 编写一个名为 calculate_circle_area 的函数,该函数接收圆的半径 radius 作为参数,并返回圆的面积。圆的面积 π * radius (可以使用 math.pi 作为 π 的值)要求:函数接收一个位置参数 radi…...
鸿蒙HarmonyOS 5军旗小游戏实现指南
1. 项目概述 本军旗小游戏基于鸿蒙HarmonyOS 5开发,采用DevEco Studio实现,包含完整的游戏逻辑和UI界面。 2. 项目结构 /src/main/java/com/example/militarychess/├── MainAbilitySlice.java // 主界面├── GameView.java // 游戏核…...