SVN是subversion的缩写,是一个开放源代码的版本控制系统,通过采用分支管理系统的高效管理,简而言之就是用于多个人共同开发同一个项目,实现共享资源,实现最终集中式的管理。
Apache Subversion 通常被缩写成 SVN,是一个开放源代码的版本控制系统,Subversion 在 2000 年由 CollabNet Inc 开发,现在发展成为 Apache 软件基金会的一个项目,同样是一个丰富的开发者和用户社区的一部分。
SVN相对于的RCS、CVS,采用了分支管理系统,它的设计目标就是取代CVS。互联网上免费的版本控制服务多基于Subversion
这篇博客只是简单地介绍了SVN的安装及环境变量的配置,详细的使用方法,可以参考:
https://www.runoob.com/svn/svn-tutorial.html
中央仓库(Respository) : SVN服务器上文件的保存位置
工作空间(Workspace) : 操作者下载到本地的文件的位置
前提:这里利用yum安装 , 安装之前还是要查看是否已经安装,我们这里用阿里云远程服务器测试
yum -y install subversion
# 一会就安装好了,等待安装完成即可(信息如下)
[root@iZuf69s5ga2219syf1pqgpZ ~]# yum -y install subversion
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 166 kB 00:00:00
(2/7): epel/x86_64/group_gz | 88 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 949 kB 00:00:00
(4/7): epel/x86_64/primary_db | 6.6 MB 00:00:00
(5/7): extras/7/x86_64/primary_db | 156 kB 00:00:00
(6/7): base/7/x86_64/primary_db | 6.0 MB 00:00:00
(7/7): updates/7/x86_64/primary_db | 1.3 MB 00:00:00
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package subversion.x86_64 0:1.7.14-14.el7 will be installed
--> Processing Dependency: subversion-libs(x86-64) = 1.7.14-14.el7 for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_wc-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_subr-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_repos-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_ra_svn-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_ra_neon-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_ra_local-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_ra-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_fs_util-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_fs_fs-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_fs_base-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_fs-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_diff-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_delta-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libsvn_client-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package neon.x86_64 0:0.30.0-3.el7 will be installed
--> Processing Dependency: libgnutls.so.28(GNUTLS_2_12)(64bit) for package: neon-0.30.0-3.el7.x86_64
--> Processing Dependency: libgnutls.so.28(GNUTLS_1_4)(64bit) for package: neon-0.30.0-3.el7.x86_64
--> Processing Dependency: libproxy.so.1()(64bit) for package: neon-0.30.0-3.el7.x86_64
--> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.30.0-3.el7.x86_64
--> Processing Dependency: libgnutls.so.28()(64bit) for package: neon-0.30.0-3.el7.x86_64
---> Package subversion-libs.x86_64 0:1.7.14-14.el7 will be installed
--> Running transaction check
---> Package gnutls.x86_64 0:3.3.29-8.el7 will be installed
--> Processing Dependency: trousers >= 0.3.11.2 for package: gnutls-3.3.29-8.el7.x86_64
--> Processing Dependency: libnettle.so.4()(64bit) for package: gnutls-3.3.29-8.el7.x86_64
--> Processing Dependency: libhogweed.so.2()(64bit) for package: gnutls-3.3.29-8.el7.x86_64
---> Package libproxy.x86_64 0:0.4.11-11.el7 will be installed
--> Processing Dependency: libmodman.so.1()(64bit) for package: libproxy-0.4.11-11.el7.x86_64
---> Package pakchois.x86_64 0:0.4-10.el7 will be installed
--> Running transaction check
---> Package libmodman.x86_64 0:2.0.1-8.el7 will be installed
---> Package nettle.x86_64 0:2.7.1-8.el7 will be installed
---> Package trousers.x86_64 0:0.3.14-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
subversion x86_64 1.7.14-14.el7 base 1.0 M
Installing for dependencies:
apr x86_64 1.4.8-3.el7_4.1 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
gnutls x86_64 3.3.29-8.el7 base 680 k
libmodman x86_64 2.0.1-8.el7 base 28 k
libproxy x86_64 0.4.11-11.el7 base 64 k
neon x86_64 0.30.0-3.el7 base 165 k
nettle x86_64 2.7.1-8.el7 base 327 k
pakchois x86_64 0.4-10.el7 base 14 k
subversion-libs x86_64 1.7.14-14.el7 base 922 k
trousers x86_64 0.3.14-2.el7 base 289 k
Transaction Summary
==============================================================================================
Install 1 Package (+10 Dependent packages)
Total download size: 3.6 M
Installed size: 12 M
Downloading packages:
(1/11): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(2/11): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00
(3/11): libmodman-2.0.1-8.el7.x86_64.rpm | 28 kB 00:00:00
(4/11): libproxy-0.4.11-11.el7.x86_64.rpm | 64 kB 00:00:00
(5/11): gnutls-3.3.29-8.el7.x86_64.rpm | 680 kB 00:00:00
(6/11): neon-0.30.0-3.el7.x86_64.rpm | 165 kB 00:00:00
(7/11): nettle-2.7.1-8.el7.x86_64.rpm | 327 kB 00:00:00
(8/11): pakchois-0.4-10.el7.x86_64.rpm | 14 kB 00:00:00
(9/11): subversion-libs-1.7.14-14.el7.x86_64.rpm | 922 kB 00:00:00
(10/11): trousers-0.3.14-2.el7.x86_64.rpm | 289 kB 00:00:00
(11/11): subversion-1.7.14-14.el7.x86_64.rpm | 1.0 MB 00:00:00
----------------------------------------------------------------------------------------------
Total 12 MB/s | 3.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-3.el7_4.1.x86_64 1/11
Installing : apr-util-1.5.2-6.el7.x86_64 2/11
Installing : pakchois-0.4-10.el7.x86_64 3/11
Installing : nettle-2.7.1-8.el7.x86_64 4/11
Installing : libmodman-2.0.1-8.el7.x86_64 5/11
Installing : libproxy-0.4.11-11.el7.x86_64 6/11
Installing : trousers-0.3.14-2.el7.x86_64 7/11
Installing : gnutls-3.3.29-8.el7.x86_64 8/11
Installing : neon-0.30.0-3.el7.x86_64 9/11
Installing : subversion-libs-1.7.14-14.el7.x86_64 10/11
Installing : subversion-1.7.14-14.el7.x86_64 11/11
Verifying : trousers-0.3.14-2.el7.x86_64 1/11
Verifying : libmodman-2.0.1-8.el7.x86_64 2/11
Verifying : neon-0.30.0-3.el7.x86_64 3/11
Verifying : subversion-1.7.14-14.el7.x86_64 4/11
Verifying : subversion-libs-1.7.14-14.el7.x86_64 5/11
Verifying : apr-util-1.5.2-6.el7.x86_64 6/11
Verifying : nettle-2.7.1-8.el7.x86_64 7/11
Verifying : gnutls-3.3.29-8.el7.x86_64 8/11
Verifying : pakchois-0.4-10.el7.x86_64 9/11
Verifying : apr-1.4.8-3.el7_4.1.x86_64 10/11
Verifying : libproxy-0.4.11-11.el7.x86_64 11/11
Installed:
subversion.x86_64 0:1.7.14-14.el7
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7
gnutls.x86_64 0:3.3.29-8.el7 libmodman.x86_64 0:2.0.1-8.el7
libproxy.x86_64 0:0.4.11-11.el7 neon.x86_64 0:0.30.0-3.el7
nettle.x86_64 0:2.7.1-8.el7 pakchois.x86_64 0:0.4-10.el7
subversion-libs.x86_64 0:1.7.14-14.el7 trousers.x86_64 0:0.3.14-2.el7
Complete!
[root@iZuf69s5ga2219syf1pqgpZ ~]# svn --version
svn, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
Copyright (C) 2013 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_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
* 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
mkdir /opt/svn
svnadmin create /opt/svn/kuangshen
# 查看防火墙状态
firewall-cmd --state
# 开启防火墙
systemctl start firewalld.service
# 开启3690端口
firewall-cmd --zone=public --add-port=3690/tcp --permanent
# 重启防火墙
systemctl restart firewalld.service
# 输入命令重新载入配置
firewall-cmd --reload
# 查看开启的端口列表
firewall-cmd --permanent --list-port
# 查看是否启动svn服务
ps -ef|grep svn
# 使用命令svnserve启动服务
svnserve -d -r /opt/svn --listen-port=3690
[users]
# harry = harryssecret
# sally = sallyssecret
admin = 123456
guest = 000000
用户名=密码
这样我们就建立了两个用户
以上语句都必须顶格写,左侧不能留空格,否则会出错.
vi authz
设置哪些用户可以访问哪些目录,向authz文件追加以下内容:
#设置[/]代表根目录下所有的资源 , 或者写成[kuangshen:/]
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
admin=user1
guest=user2
[kuangshen:/]
@admin=rw
user2=r
以上语句都必须顶格写, 左侧不能留空格, 否则会出错.
vim svnserve.conf
追加以下内容:
[general]
#匿名访问的权限,可以是read,write,none,默认为read
anon-access=none
#使授权用户有写权限
auth-access=write
#密码数据库的路径
password-db=passwd
#访问控制文件
authz-db=authz
#认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字
realm= repo
以上语句都必须顶格写, 左侧不能留空格,否则会出错.
window安装TortoiseSVN,这个下载后直接安装即可
svn://ip地址
端口默认为3690,输入配置好的用户名和密码即可。
注意: svn://ip地址/库名,使用svnserve -d -r /opt/svn 以多库svnserve方式启动SVN
我们这里使用 svn://ip地址/库名 连接