搭建svn服务器_ubuntu

本文档详细介绍了如何在Ubuntu系统中安装Subversion(SVN)服务器,包括安装过程、创建版本仓库、设置访问权限、添加用户、设置用户权限及测试服务器运行状态。此外,还提到了使用TortoiseSVN进行客户端操作的步骤。
摘要由CSDN通过智能技术生成

目录

安装

安装svn

 检查是否安装成功

配置

创建版本仓库

 设置访问权限

 添加用户

 设置用户权限

 测试


安装

安装svn

root@ubuntu:~# apt-get update
root@ubuntu:~# apt-get install subversion

 检查是否安装成功

root@ubuntu:~# svn --version
svn, version 1.9.3 (r1718519)
   compiled Jul 26 2019, 15:51:17 on x86_64-pc-linux-gnu

Copyright (C) 2015 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.8 (compiled with 1.3.8)
  - handles 'http' scheme
  - handles 'https' scheme

The following authentication credential caches are available:

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

配置

创建版本仓库

# 新建目录,用于存放代码仓库
root@ubuntu:~# mkdir /data/svn

# 设置权限
root@ubuntu:/data/svn# chmod -R 777 /data/svn

# 创建svn仓库
svnadmin create /usr/svn/repository

# 创建完成后生成如下目录和文件
root@ubuntu:/data/svn# svnadmin create /data/svn/repository
root@ubuntu:/data/svn# ll
total 12
drwxrwxrwx 3 root root 4096 Apr 11 19:34 ./
drwxr-xr-x 4 root root 4096 Apr 11 19:30 ../
drwxr-xr-x 6 root root 4096 Apr 11 19:34 repository/
root@ubuntu:/data/svn# cd repository/
root@ubuntu:/data/svn/repository# ll
total 32
drwxr-xr-x 6 root root 4096 Apr 11 19:34 ./
drwxrwxrwx 3 root root 4096 Apr 11 19:34 ../
drwxr-xr-x 2 root root 4096 Apr 11 19:34 conf/
drwxr-sr-x 6 root root 4096 Apr 11 19:34 db/
-r--r--r-- 1 root root    2 Apr 11 19:34 format
drwxr-xr-x 2 root root 4096 Apr 11 19:34 hooks/
drwxr-xr-x 2 root root 4096 Apr 11 19:34 locks/
-rw-r--r-- 1 root root  246 Apr 11 19:34 README.txt

# 对db进入权限设置
root@ubuntu:/data/svn/repository# chmod -R 777 db
root@ubuntu:/data/svn/repository# ll
total 32
drwxr-xr-x 6 root root 4096 Apr 11 19:34 ./
drwxrwxrwx 3 root root 4096 Apr 11 19:34 ../
drwxr-xr-x 2 root root 4096 Apr 11 19:34 conf/
drwxrwsrwx 6 root root 4096 Apr 11 19:34 db/
-r--r--r-- 1 root root    2 Apr 11 19:34 format
drwxr-xr-x 2 root root 4096 Apr 11 19:34 hooks/
drwxr-xr-x 2 root root 4096 Apr 11 19:34 locks/
-rw-r--r-- 1 root root  246 Apr 11 19:34 README.txt

 设置访问权限

root@ubuntu:/data/svn/repository# cd conf/
root@ubuntu:/data/svn/repository/conf# vim svnserve.conf

按照下图配置 

 添加用户

root@ubuntu:/data/svn/repository/conf# vim passwd

 设置用户权限

添加admin组和user_r组,权限分别为读写和只读

root@ubuntu:/data/svn/repository/conf# vim authz

 测试

# 启动svn服务器
root@ubuntu:/data/svn/repository/conf# svnserve -d -r /data/svn/
# -d:表示在后台运行
# -r:指定服务器的根目录

# 查看是否启动成功 
root@ubuntu:/data/svn/repository/conf# ps aux | grep svnserve
root       3976  0.0  0.0  73488   940 ?        Ss   20:25   0:00 svnserve -d -r /data/svn/
root       3989  0.0  0.0  14220  1080 pts/0    S+   20:27   0:00 grep --color=auto svnserve

# 停止服务器
root@ubuntu:/data/svn/repository/conf# killall svnserve

# 检查进程是否存在
root@ubuntu:/data/svn/repository/conf# ps aux | grep svnserve
root       4004  0.0  0.0  14220  1080 pts/0    S+   20:29   0:00 grep --color=auto svnserve

 安装TortoiseSVN,输入svn地址:svn://IP/repository,输入用户名和密码,上传文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值