`
dcj3sjt126com
  • 浏览: 1830349 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Centos搭建SVN服务器三步曲

 
阅读更多

搭建SVN服务,有效的管理代码,以下三步可以快速搞定。
1、安装          

#yum install subversion

  判断是否安装成功
#subversion -v

  svnserve, version 1.6.11 (r934486)
出现上面的提示,说明安装成功。

   如果提示如下:-bash: subversion: command not found
   经过查找发现:
  [root@]# svnserve --version
svnserve, version 1.6.11 (r934486)
   compiled Apr 11 2013, 16:13:51

Copyright (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库。
#mkdir /opt/svn/repos
#svnadmin create /opt/svn/repos
执行上面的命令后,自动在repos下建立多个文件, 分别是conf, db,format,hooks, locks, README.txt。

    

2、配置

     上面的操作很简单,几个命令就搞定, 下面的操作也不难。
     进入上面生成的文件夹conf下,进行配置,   有以下几个文件authz, passwd, svnserve.conf
     其中authz 是权限控制,可以设置哪些用户可以访问哪些目录,   passwd是设置用户和密码的,    svnserve是设置svn相关的操作。


   2.1先设置passwd
    

[users]
# harry = harryssecret
# sally = sallyssecret
hello=123
用户名=密码

这样我们就建立了hello用户, 123密码  


   2.2 再设置权限authz

[/]
hello= rw

意思是hello用户对所有的目录有读写权限,当然也可以限定。
如果是自己用,就直接是读写吧。



2.3最后设定snvserv.conf

anon-access = none # 使非授权用户无法访问
auth-access = write # 使授权用户有写权限
password-db = password
authz-db = authz   # 访问控制文件
realm = /opt/svn/repos # 认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。
采用默认配置. 以上语句都必须顶格写, 左侧不能留空格, 否则会出错.


好了,通过以上配置,你的svn就可以了。

3、连接

启动svn: svnserve --/opt/svn/repos

如果已经有svn在运行,可以换一个端口运行
svnserve --/opt/svn/repos --listen-port 3391

这样同一台服务器可以运行多个svnserver

好了,启动成功后,就可以使用了。
建议采用TortoiseSVN, 连接地址为: svn://your server address (如果指定端口需要添加端口  :端口号)

连接后可以上传本地的文件,有效的管理你的代码。

 

查看SVN运行情况
[test@localhost /]#netstat -tunlp | grep svn

tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      8646/svnserve

查看服务的进程号:
[test@localhost svn]$ ps -A | grep svn
4094 ?         00:00:00 svnserve 
关闭进程:#kill 4094

配置自动启动:
把svnserve -d -r /opt/svn/ 放在/etc/rc.d/rc.local最后一行

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics