快速搭建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
下一篇 2016-12-12

相关推荐

  • Liunx获取信息帮助与man文档章节的划分

    首先要判断命令的类型,可用 type COMMAND 来判断命令 如果显示结果为(….是 shell内嵌)即为shell内嵌命令,如需获取帮助,使用 help COMMAND 即可; 下图的例子是pwd是shell内嵌命令 内部命令属于Shell的一部分,所以并没有单独对应的系统文件,只要Shell解释器被运行,内部指…

    2017-07-02
  • iptables练习

    iptables练习 一、COMMAND 1、列出所有链的规则:iptables -L ,显示某条链的规则就是iptables -L INPUT 详细信息:iptables -vnL 2、清楚所有链的规则 :iptables -F 3、设置默认规则策略:iptables -P INPUT DROP,iptables -P OUTPUT DROP , ipta…

    Linux干货 2016-12-20
  • Linux第一周学习心得

                           LINUX入门学习心得 Shell基本命令 ### shell可执行命令分类 ### 内部命令:由shell自带得,而且通过某命令形式提供 help 内部命令列表 enble cmd 启用内部命…

    Linux干货 2017-07-15
  • 网络管理命令

    linux网络属性     ifconfig命令家族:ifconfig,route,netstat ifconfig命令:接口及地址查看和管理     ifconfig [interface]:     ifconfig -a:显示所有接口…

    Linux干货 2016-09-13
  • CA证书服务搭建与申请

    服务端根CA创建证书 进入固定目录,创建所需要的文件 cd /etc/pki/CA/ touch /etc/pki/CA/index.txt 生成证书索引数据库文件 echo 01 > /etc/pki/CA/serial 指定第一个颁发证书的序列号 生成秘钥 (umask 066;openssl genrsa -out /etc/pki/CA/pri…

    2017-09-11
  • 2016/10/26作业:用户和组的相关配置文件

    linux系统是通过文件来保存配置的,其中关于用户和组的配置文件包括以下几个: /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/login.defs /etc/default/useradd /etc/passwd 存放用户信息的配置文件,其基本格式如下 root:x:0:0:root:/root:/…

    Linux干货 2016-10-26