CentOS下安装配置SVN服务器

来源:互联网 发布:天龙抢号软件 编辑:程序博客网 时间:2024/05/16 12:01

SVN服务器有两种运行方式,一种是基于Apache Http Server,另外一种是Subversion Standalone Server。下面讲的是在CentOS下svnserve的方式的SVN服务器的安装和使用。

检查已安装版本

#检查是否安装了SVN[root@VM_114_176_centos /]# rpm -qa subversion#卸载旧版本SVN[root@VM_114_176_centos /]# yum remove subversion

安装SVN

[root@VM_114_176_centos /]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql

确认已安装的svn模块

[root@VM_114_176_centos /]# cd /etc/httpd/modules[root@VM_114_176_centos modules]# ls | grep svnmod_authz_svn.somod_dav_svn.so

验证安装

检验已经安装的SVN版本信息 [root@VM_114_176_centos modules]# svnserve --versionsvnserve, version 1.6.11 (r934486)   compiled Aug 17 2015, 08:21:51Copyright (C) 2000-2009 CollabNet.Subversion is open source software, see http://subversion.tigris.org/This product includes software developed by CollabNet (http://www.Collab.Net/).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.

代码版本库创建

SVN软件安装完成后,还需要建立SVN的代码版本库,用于管理代码。我们将库建在/opt/svn目录下。下面以创建myweb版本库为例子演示.

[root@VM_114_176_centos /]# mkdir -p /opt/svn/myweb[root@VM_114_176_centos /]# svnadmin create /opt/svn/myweb

执行上面的命令后,自动建立myweb库,查看/opt/svn/myweb 文件夹发现包含了conf, db,format,hooks, locks,README.txt等文件,说明一个SVN版本库已经建立。

配置代码库

建立好版本库后我们要配置相应的权限认证,在每个库目录下的conf目录下(如/opt/svn/myweb/conf/目录下)能 看到svnserve.conf、passwd和authz这三个文件,用于代码库的相关配置。

conf下的svnserve.conf

追加以下内容:

[general]#匿名访问的权限,可以是read,write,none,默认为readanon-access=none#使授权用户有写权限 auth-access=write#密码数据库的路径 password-db=passwd#访问控制文件 authz-db=authz

conf下的passwd

用户名和密码的配置,修改/opt/svn/myweb下的passwd,追加以下内容:

[users]# harry = harryssecret# sally = sallyssecretzhang=123456

conf下的auth

用户访问权限的配置,修改/opt/svn/myweb下的auth,目的是设置哪些用户可以访问哪些目录,追加以下内容:

#设置[/]代表根目录下所有的资源 [/]zhang=rw

配置防火墙端口

[root@VM_114_176_centos /]# vi /etc/sysconfig/iptables
添加以下内容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
保存后重启防火墙
[root@VM_114_176_centos /]# service iptables restart

启动SVN

svnserve -d -r /opt/svn/myweb

查看SVN进程

[root@VM_114_176_centos /]# ps -ef|grep svn|grep -v greproot     14423     1  0 10:17 ?        00:00:00 svnserve -d -r /opt/svn/myweb

检测SVN 端口

[root@VM_114_176_centos /]# netstat -ln |grep 3690tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN

停止重启SVN

[root@VM_114_176_centos /]# killall svnserve    //停止 [root@VM_114_176_centos /]# svnserve -d -r /opt/svn/myweb  // 启动

使用SVN

SVN服务已经启动,使用客户端测试连接

客户端连接地址:svn://192.168.15.231/myweb用户名/密码:  zhang/123456

使用客户端工具,连接效果如图所示:
这里写图片描述

1 0
原创粉丝点击