Centos 6.5下SVN服務安裝配置

類別:原創 服務器 linux

本文參考
svn安裝參考 http://blog.csdn.net/sxhong/article/details/9176881
svn命令參考 http://blog.csdn.net/gexiaobaohelloworld/article/details/7752862服務器

第一:說明,軟件說明,和安裝的目的
架設基於linux下的SVN服務器,進行版本控制。 app

第二:本例操做環境
所使用的系統環境爲 Centos 6.5 64位操做系統 tcp

[root@tian ~]# uname -a
Linux tian.test.com 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@tian ~]# hostname
tian.test.com
[root@tian ~]# more /etc/redhat-release
CentOS release 6.5 (Final)
[root@tian ~]# ide

第三:服務器安裝配置
1.  安裝必須的軟件包

subversion svn

[root@tian ~]# yum install subversion -y
[root@tian ~]# svnserve --version
svnserve, version 1.6.11 (r934486)
   compiled Mar  6 2014, 10:49:10 測試

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/). this

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. .net

Cyrus SASL authentication is available.

有了SVN軟件後還須要創建SVN庫


2.建立svn倉庫
[root@tian ~]#
[root@tian ~]# mkdir /svn
[root@tian ~]# svnadmin create /svn
執行上面的命令後,自動創建多個文件, 分別是conf, db, format, hooks, locks, README.txt。
[root@tian ~]# ls /svn
conf  db  format  hooks  locks  README.txt
[root@tian ~]#

3.修改svn用戶認證文件
[root@tian ~]# cat /svn/conf/passwd | egrep -v "^#|^$"         
[users]
tian = tian1234

4.修改svn用戶權限控制文件
[root@tian ~]# cat /svn/conf/authz | egrep -v "^#|^$"       
[aliases]
[groups]
[/]
tian = wr
[root@tian ~]#

5.修改svn服務器配置文件
[root@tian ~]# cat /svn/conf/svnserve.conf | egrep -v "^#|^$"  
[general]
anon-access = none # 使非受權用戶沒法訪問
auth-access = write # 使受權用戶有寫權限
password-db = password
authz-db = authz   # 訪問控制文件
realm = My First Repository # 描述
[sasl]
以上語句都必須頂格寫, 左側不能留空格, 不然會出錯.
[root@tian ~]#

第四:啓動svnserve服務
1.編輯服務進程文件/etc/init.d/svnserve 在最前面增長一行


OPTIONS=" -r /svn"

2.啓動svnserve服務
[root@tian ~]# service  svnserve restart
Stopping svnserve:                                         [  OK  ]
Starting svnserve:                                         [  OK  ]
[root@tian ~]#
[root@tian ~]# netstat -tlnp | grep svn
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      3288/svnserve      
[root@tian ~]#

3.設置svn開機自啓動
[root@tian samba]# chkconfig svnserve on

固然也能夠

好了,經過以上配置,你的svn就能夠了。

第五:測試
[root@tian ~]# svn co svn://127.0.0.1 svntest --username tian --password tian1234

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://127.0.0.1:3690> My First Repository

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
A    svntest/Desktop.ini
Checked out revision 1.
[root@tian ~]#
[root@tian ~]# touch svntest/test
[root@tian ~]# svn update svntest/
At revision 1.
[root@tian ~]#
[root@tian ~]# svn add svntest/test
A         svntest/test
[root@tian ~]# svn ci -m "test" svntest/test
Adding         svntest/test
Transmitting file data .
Committed revision 2.
[root@tian ~]#

第六:補充

1.也能夠不使用服務方式啓svn 以下
[root@tian ~]# svnserve -d -r /svn
[root@tian ~]#


2.若是已經有svn在運行,能夠換一個端口運行
[root@tian ~]# svnserve -d -r /svn --listen-port 3391
這樣同一臺服務器能夠運行多個svnserver

好了,啓動成功後,就能夠使用了。

至此 全部配置完成

相關文章
相關標籤/搜索