📘SVN 服务器环境搭建

📘SVN 服务器环境搭建

环境声明

ubuntu 24.04

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble

安装服务端 subversion

sudo apt install subversion
svn --version
svn, version 1.14.3 (r1914484)
   compiled Apr  1 2024, 04:55:49 on x86_64-pc-linux-gnu

Copyright (C) 2023 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 access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.10 (compiled with 1.3.10)
  - handles 'http' scheme
  - handles 'https' scheme

The following authentication credential caches are available:

* Plaintext cache in /home/luyang/.subversion
* Gnome Keyring
* GPG-Agent
* KWallet (KDE)

创建版本库

mkdir -p /home/luyang/svn
cd /home/luyang/svn

sudo svnadmin create material

sudo chmod 777 material -R
ls material/
README.txt  conf/  db/  format  hooks/  locks/

修改 SVN 配置

高端配置

conf/authz

[aliases]
# demo_alias = /C=XX/ST=YY/L=ZZ/O=Demo Corp/OU=Research/CN=John Doe

[groups]
manager = user1,user2
hardware = user3,user4
software = user5,user6
algo = user2,user7,user5

# [/foo/bar]
# userA = rw
# &demo_alias = r
# * =

# [repository:/baz/fuz]
# @group_demo = rw
# * = r

[material:/]
@manager  = rw
@hardware = rw
@software = rw
@algo     = rw
* =

/conf/passwd

[users]
user1 = pass_user1
user2 = pass_user2
user3 = pass_user3
user4 = pass_user4
user5 = pass_user5
user6 = pass_user6
user7 = pass_user7

重启 svn 服务

sudo svnserve -d -r /home/luyang/workspace/svn/

ps aux | grep svnserve
root      128325  0.0  0.0  16580  2476 ?        Ss   13:05   0:00 svnserve -d -r material/
luyang    128450  0.0  0.0   4092  1920 pts/4    S+   13:05   0:00 grep --color=auto svnserve

svn 默认端口:3690

ss -tuln | grep 3690
tcp   LISTEN 0      128           0.0.0.0:3690      0.0.0.0:*

客户端检出仓库

安装 TortoiseSVN ![[Pasted image 20250910140302.png]] 检出仓库,注意路径: 服务端启动时已经通过 -r /home/luyang/workspace/svn/ 而我们的 material 仓库位于该目录下因此 svn co 路径可以忽略 -r 指定的部分。