一、svn的安装独立安装(单库的安装)
说明:就是svn服务器访问的方式是svn的方式,其中的访问地址是:svn://192.168.18.201的方式来访问的。
1)安装
yum -y install subversion
2)创建仓库,在home下面创建一个svn的仓库(repository),以后所有代码都放在这个下面,创建成功后在svn下面多了几个文件夹。
cd /home
mkdir svn
svnadmin create /home/svn
ls svn
#创建respository时列出的文件
conf db format hooks locks README.txt
3)使用svn --version来检测subversion是否安装成功
[root@localhost conf]# 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
4)注意在创建respository的仓库中在conf文件下有三个重要的文件authz、passwd、svnserve.conf
authz 是权限控制文件
passwd 是帐号密码文件
svnserve.conf 是SVN服务配置文件
5)配置用户和密码,打开conf下面的passwd文件
vim passwd
### 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
# sally = sallyssecret
#用户名=密码
weiwei=weiwei
biele=biele
其中在[users]下配置前面的是用户名称,后面的是密码
6)配置读写授权和仓库权限,配置authz文件
vim authz
### 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
[/]
weiwei = rw
biele = r
* =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
其中[aliases]
其中[groups]是用户分组
#这个是分组的标签
[groups]
#前面的是分组名称,后面的是在这个分组里面的有哪些用户,一个分组里面有多个用户用逗号分开
admin = weiwei
test = test1,test2,biele
其中[/]是配置文件的路径的权限
#仓库下的所有文件
[/]
#上面对应的路径下的文件对用户weiwei可读可写权限
weiwei = rw
#上面的对应的路径下文件对用户biele只可以读,不能进行写操作
biele = r
#其他用户没有任何权限,这个配置很重要
* =
#仓库下的所有文件
[/]
#上面对应的路径下的文件对用户用户组的所有用户可读可写权限
@admin = rw
#上面的对应的路径下文件对用户组的所有用户只可以读,不能进行写操作
@test = r
#其他用户没有任何权限,这个配置很重要
* =
7)配置svnserver.conf的服务配置
vim svnserve.conf
#下面是打开的文件部分内容,打开下面的5个注释
--------------------------------------------
#匿名用户可读
anon-access = read
#授权用户可写
auth-access = write
#使用哪个文件作为账号文件
password-db = passwd
#使用哪个文件作为权限文件
authz-db = authz
#认证空间名,版本库所在目录
realm = /home/svn
--------------------------------------------
注意:realm记得改成你的svn目录;打开注释时切记前面不要留有空格
8)启动和停止svn的服务
#svn服务启动,其中后面要是自己的仓库目录
svnserve -d -r /home/svn
#svn停止
killall svnserve
#停止svn或者可以杀死进程
ps aux | grep svnserve
#列出svnserve的进程id,kill杀死进程
kill -9 进程id
二、svn的和apache httpd进行安装
说明:就是svn服务器访问的方式是svn的方式,其中的访问地址是:http:svn://192.168.18.201的方式来访问的。
1)先要安装httpd的服务:其中安装方式参考文章:httpd的简介和安装linux
2)安装httpd的svn的模块,来进行连接到svn的服务器上
#安装httpd的svn的模块
yum install mod_dav_svn
3)重启apache
systemctl restart httpd.service
4)查看测试是否安装 svn 模块
ls /etc/httpd/modules/ | grep svn
----------------------------------
mod_authz_svn.so
mod_dav_svn.so
----------------------------------
5)
三、用可视化来进行管理svn的服务和respository:jsvnadmin 。
1)Svn Admin 是一个 Java 开发的管理 Svn 服务器的项目用户的 web 应用。安装好 Svn 服务器端好,把 Svn Admin 部署好,就可以通过 web 浏览器管理 Svn 的项目,管理项目的用户,管理项目的权限。使得管理配置 Svn 简便,再也不需要每次都到服务器手工修改配置文件。
2)其中jsvnadmin的安装要依赖tomcat的服务器,还有配置信息是存储在mysql中的,其中tomcat的服务需要依赖jdk。所以在安装jsvnadmin要先安装如下:
jdk的安装 https://blog.csdn.net/weily11/article/details/81095911
tomcat的安装 https://blog.csdn.net/weily11/article/details/81096842
mysql的安装