快速搭建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

相关推荐

  • MongoDB安装部署手稿

    Edit MongoDB 手册 MongoDB 手册 第一章 Introduction MongoDB入门学习目录(建议) Databases Collections Documents 第二章 部署安装 1. Import the MongoDB public key 2. Configure the package management system (…

    Linux干货 2016-03-26
  • M20-1扩展正则表达式作业

    1、取本机ip地址 [root@centos6 ~]# ifconfig eth1      Link encap:Ethernet  HWaddr 00:0C:29:35:DD:AB     &nb…

    Linux干货 2016-08-10
  • Linux基础知识(五)

    1、显示当前系统上root、fedora或user1用户的默认shell [root@server01 ~]# cat /etc/passwd | grep –color=auto -E "^root|fedora|user1" | cut -d : -f 1,7 2、找出/etc/rc.d/init.d/functions文…

    Linux干货 2016-10-25
  • 自动化运维工具Puppet

        开发puppet模块,nginx负载均衡并反代动态请求至httpd,httpd用ajp连接器将反代请求至tomcat,并部署tomcat-session-memcached 架构图为 在master主机上开发的模块为: 1、chrony模块; ├── chrony│   ├── files│…

    2017-07-28
  • 什么是CA??

       数字证书认证机构(英语:Certificate Authority,缩写为CA),也称为电子商务认证中心、电子商务认证授权机构,是负责发放和管理数字证书的权威机构,并作为电子商务交易中受信任的第三方,承担公钥体系中公钥的合法性检验的责任。 介绍     CA中心为每个使用公开密钥的用户发放一个…

    Linux干货 2017-07-17
  • 正则表达式

    grep:Global search REgular expression and Print out the line         文本搜索工具,根据用户指定的”模式“对目标文本逐行进行匹配检查;打印匹配到的行        模式:由正则表达式字符及文本字符所编写的过滤条件…

    Linux干货 2016-08-08