快速搭建SVN服务器

一、背景介绍

svn服务器是一款上传代码的工具(貌似这么说不怎么严谨,但是在日常工作中基本上是这么用的),今天一个小伙伴折腾了一天也没有搭建好这个svn服务器。各种问题,其实搭建SVN服务器最重要的就是三个配置文件(svnserver.conf、 passwd 、authz)。出了问题的话十有八九是这三个配置文件的问题。最后,我自己搭建了一个,测试成功。于是把这个过程记录下来,以备使用。当然还有一个问题,那就是客户端的svn工具版本太低造成的,会用提示的。运维最好是在拿另外一台服务器当客户端来测试,确保自己的svnserver没有问题,然后就可以愉快的去怼开发了。

二、安装过程

[root@localhost ~]# yum -y install subversion
[root@localhost ~]# svnadmin create /home/svn/repos #svn仓库的位置
[root@localhost ~]# cd /home/svn/repos/
[root@localhost repos]# ls
conf  db  format  hooks  locks  README.txt
[root@localhost repos]# cd conf/
[root@localhost conf]# vim svnserve.conf

将以下内容的注释去掉,然后这些配置要顶头,不能与左侧有空格,不然会报错

[general]
anon-access = none     #匿名访问权限,默认read,none为不允许访问
auth-access = write   #认证用户权限  
password-db = passwd  #用户信息存放文件,默认在版本库/conf下面,也可以绝对路径指定文件位置
authz-db = authz
[root@localhost conf]# vim passwd
[users]
xiaoming = 123
zhangsan = 123
lisi = 123
[root@localhost conf]# vim authz 
[groups]           #定义组的用户
manager = xiaoming
core_dev = zhangsan,lisi
[repos:/]          #以根目录起始的repos版本库manager组为读写权限
@manager = rw
[repos:/media]     #core_dev对repos版本库下media目录为读写权限
@core_dev = rw

到此位置所有配置已完成

[root@localhost conf]# svnserve -d -r /home/svn   #启动svnserver
[root@localhost conf]# netstat -antp |grep svnserve  #查看端口号3690
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      17412/svnserve     
[root@localhost ~]# iptables -F              #关闭防火墙

三、测试

接下来到另外一台服务器上去做测试,此时这台服务器是客户端的角色

[root@localhoast svntest]# svn checkout svn://172.16.72.4/repos /svn --username xiaoming --password 123              
-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:
   <svn://172.16.72.4:3690> ef513f9d-89b5-4751-94fa-bfadb578deb4
can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Checked out revision 0.    #成功

svn现在的使用率一直在下降,被git所取代,就像apache被nginx取代一样。但这也是一款很常用的程序,至少开发每天都在用。


原创文章,作者:hanlln1,如若转载,请注明出处:http://www.178linux.com/63299

(2)
hanlln1hanlln1
上一篇 2016-12-11 22:28
下一篇 2016-12-12 00:57

相关推荐

  • 位置变量&特殊变量总结

    位置变量 常用的位置变量有 $1, $2, $3 ……,表示命令行传给脚本的第一个参数,第二个参数,第三个参数。。。 $0 表示脚本的文件名,比如a.sh 位置变量在脚本中的主要作用,是让脚本通过他们来获取命令行传递给脚本的参数。 变量位置调整 shift [n] 用于调整变量位置 第n+1个位置变量会被重新命名为$1…

    Linux干货 2016-08-15
  • DNS服务器搭建示例

    DNS服务器搭建示例 负责解析magedu.com域名,能够对一些主机名进行正向解析和逆向解析 配置主配置文件 [root@slave1 etc]# vim /etc/named.conf options { listen-on port 53 { 192.168.91.132; }; // listen-on-v6 port 53 { ::1; }; di…

    2017-09-16
  • RAID特性和常见级别

    简介:    RAID全称为独立磁盘冗余阵列(Redundant Array of Independent Disks),基本思想就是把多个相对便宜的硬盘组合起来,成为一个硬盘阵列组,使性能达到甚至超过一个价格昂贵、 容量巨大的硬盘。RAID通常被用在服务器电脑上,使用完全相同的硬盘组成一个逻辑扇区,因此操作系统只会把它当做一个硬盘。 R…

    Linux干货 2016-02-14
  • lvs基础知识

    简介  Cluster是什么?    Cluster其实就是组织多个主机构建高实现性能、高可靠、多并发、大容量的同一功能的系统。  常见的集群类型:   (1) Load Balancing: 负载均衡集群   (2) High Avaiability: 高可用集群   (3) …

    Linux干货 2015-06-23
  • LVM: Logical Volume Manager 逻辑卷管理

      一、LVM介绍         LVM: Logical Volume Manager, Version: 2             …

    Linux干货 2016-09-19
  • 马哥教育网络班20期+第2周课程练习

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 cp复制, mv剪切, rm移除 语法格式: cp复制  cp [OPTION]… [-T] SOURCE DEST  常用选项: -i:交互式 -r: 递归复制目录及内部的所有内容 -a: 归档   演示: …

    Linux干货 2016-07-12