Linux(centos)下SVN伺服器的搭建及簡單配置和使用

來源:互聯網
上載者:User

標籤:centos   linux   svn   伺服器   版本控制   



Linux下Subversion(SVN伺服器)的搭建:

1、安裝Subversion


#查看本機是否已安裝subversion


[[email protected] etc]# rpm -qa subversion


[[email protected] etc]#


#卸載舊版


[[email protected] etc]# yum remove subversion


#安裝SVN 為了便於以後操作同時安裝其他服務  可以僅安裝SVN


[[email protected] etc]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql


確認已安裝了svn模組


驗證安裝:


[[email protected] conf]# svnserve --version


svnserve,版本 1.6.11 (r934486)


  編譯於 Apr 11 2013,16:13:51


著作權 (C) 2000-2009 CollabNet。


Subversion 是開放原始碼軟體,請參閱 http://subversion.tigris.org/ 網站。


此產品包含由 CollabNet(http://www.Collab.Net/) 開發的軟體。


下列版本庫後端(FS) 模組可用: 


* fs_base : 模組只能操作BDB版本庫。


* fs_fs : 模組與文字檔(FSFS)版本庫一起工作。


Cyrus SASL 認證可用。


2、建立程式碼程式庫


[[email protected] etc]# mkdir -p /opt/svn/repositories


[[email protected] etc]# svnadmin create /opt/svn/repositories


執行上面的命令後,自動建立repositories庫,查看/opt/svn/repositories 

檔案夾發現包含了conf, db,format,hooks, locks, README.txt等檔案,說明一個SVN庫已經建立。


subversion目錄說明:
*db目錄:就是所有版本控制的資料存放檔案
*hooks目錄:放置hook指令檔的目錄
*locks目錄:用來放置subversion見艱苦鎖定資料的目錄,用來追蹤存取檔案庫的用戶端
*format檔案:是一個文字檔,裡面只放了一個整數。表示當前檔案庫配置的版本號碼
*conf目錄:是這個倉庫的設定檔(倉庫的使用者訪問帳號、許可權等)


3、添加使用者


要添加SVN使用者非常簡單,只需在/opt/svn/repositories/conf/passwd檔案添加一個形如“username=password”的條目就可以了。為了測試,我添加了如下內容:


[users]
# harry = harryssecret
# sally = sallyssecret
pm = pm_pw
server_group = server_pw
client_group = client_pw
test_group = test_pw


4、使用者權限控制


在/opt/svn/repositories/conf/authz檔案


[groups]


在這裡建立許可權組並指定組內使用者,中間用,分割

# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = zhangcy,liuzz,shenkun
user = yangxt,maym,lizh,dongyan

為許可權組分配許可權
[/]
@admin = rw
@user = rw
* =


r表示對該目錄有讀許可權,w表示對該目錄有寫入權限,rw表示對該目錄有讀寫權限。

最後一行的* =表示,除了上面設定了許可權的使用者組之外,其他任何人都被禁止訪問本目錄。這個很重要,一定要加上!

5、修改svnserve.conf檔案,讓使用者和策略配置升效.


[general]
anon-access = none
auth-access = write
password-db = /opt/svn/repositories/conf/passwd
authz-db =/opt/svn/repositories/conf/authz


6、啟動svn伺服器

svnserve -d -r /opt/svn/repositories/  或者指定連接埠號碼啟動伺服器 svnserve -d -r /opt/svn/repos --listen-port 3391


svn預設監聽3690連接埠


參考資料如下
http://jingyan.baidu.com/article/d45ad148e9cfc069542b8046.html


http://www.ha97.com/4467.html



7、MyEclipse中SVN外掛程式的安裝


到這裡下載MyEclipse下SVN外掛程式(zip包):http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240


在MyEclipse安裝目錄dropins下建立SVN檔案夾,並將下載後的zip包解壓後的features 和 plugins 檔案夾移動到SVN下,之後重啟MyEclipse。


重啟後在MyEclipse 》Window 》Show View 》other中找到SVN,並顯示SVN資產庫並在資產庫中連結的伺服器。


參考資料:http://www.cnblogs.com/xdp-gacl/p/3497016.html


8、為SVN建立項目


在MyEclipse下建立或選擇要用SVN進資料列版本設定的項目,右鍵項目選擇Team下的Share Project,按照提示即可將項目交由SVN進資料列版本設定。


9、MyEclipse中SVN外掛程式的使用:http://blog.sina.com.cn/s/blog_8a3d83320100zhmp.html

Linux(centos)下SVN伺服器的搭建及簡單配置和使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.