1、通过SVN协议访问服务器
(1)准备安装软件时,请关闭防火墙、selinux应用。
本次实验是正常开启防火墙与Selinux的应用中部署的。
安装SVN程序,程序名为:subversion
centos 7 系统自带svn
#rpm -qa subversion
[root@localhost ~]# rpm -qa subversion subversion-1.7.14-14.el7.x86_64
(2)检查已安装的版本
#svnserve --version
[root@localhost ~]# svnserve --version svnserve, 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 back-end (FS) modules are available: * fs_base : Module for working with a Berkeley DB repository. * fs_fs : Module for working with a plain file (FSFS) repository. Cyrus SASL authentication is available. [root@localhost ~]#
(3)创建SVN版本库,先创建根目录,再创建项目存放的位置;
# mkdir -p /home/svn
[root@localhost ~]# svnadmin create /home/svn/desgin 设计部门使用
[root@localhost ~]# svnadmin create /home/svn/dev 研发部门使用
(4)配置代码库
进入 /home/svn/desgin 目录后,有以下文件;
authz : 权限控制文件
passwd : 账号密码文件
svnserve.conf : SVN服务配置文件
首先写入账号密码
# 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
admin = 111111 user1 = 111111 user2 = 111111
编辑完成后,保存并退出。
设置权限控制
# vim authz
[groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe design = user1,user2,user... developer = user11,user22,user...
[/]
admin = rw 管理员具有所权限
* =
[/desgin] design = rw 设计部权限 * =
[/dev] dev = rw 研发部权限 * =
最后修改svnserve.conf文件
anon-access=none #匿名用户不可访问 auth-access=write #授权用户可写 password-db=passwd #使用哪个文件作为账号文件 authz-db = authz #使用哪个文件作为权限文件 realm = My First Repository #认证空间名,版本库所在目录
(5)SVN 启动与停止
# svnserve -d -r /home/svn #让svn以deamon守护进程方式 以root用户启动运行
查看SVN进程
# ps aux | grep svn
[root@localhost ~]# netstat -tunlp | grep 3690 tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 19195/svnserve
关闭SVN
# killall svnserve
[root@localhost ~]# netstat -tunlp | grep 3690
(6)访问SVN服务
地址:svn://IP/desgin(项目名称)
原文:https://www.cnblogs.com/comprehensive/p/12090757.html