新手指南:Subversion服務器安裝行之有效的方法
你是否了解Subversion服務器安裝,這里就向大家簡單介紹一下,歡迎大家能和我一起學習Subversion服務器安裝。Subversion是新一代的開源版本控制系統(tǒng),用以取代CVS。本文主要介紹Subversion服務器安裝,有關Subversion最詳盡的資料就是官方的SubversionBook了。它是由開源社區(qū)編寫的自由圖書,已通過O'ReillyMedia出版。下面簡單介紹一下Subversion在Debian下的安裝和配置過程。
安裝:
debian:~#apt-getinstallsubversionsubversion-tools
創(chuàng)建一個新的儲存庫:
debian:~#svnadmincreate/data/svn在/data/svn目錄創(chuàng)建一個新的空儲存庫,數(shù)據(jù)儲存方式默認采用BerkeleyDB。
導入你的源碼:
debian:~#svnimport/data/ldapfile:///data/svn/ldap把/data/ldap整個目錄導入到儲存庫中的ldap目錄中,儲存庫的ldap目錄會自動創(chuàng)建。
顯示儲存庫內(nèi)容:
debian:~#svnlistfile:///data/svn/ldap
ldap_add.py
ldap_del.py
ldap_modify.py
ldap_search.py
顯示ldap目錄內(nèi)容,成功導入。
上面我使用了file:///形式的URL來訪問Subversion庫,這表示在本地通過文件系統(tǒng)訪問。但我們的Subversion庫可能需要通過網(wǎng)絡被其它用戶訪問,這就需要用到其它的協(xié)議,下表是Subversion支持的各種訪問協(xié)議:Table9.1.訪問協(xié)議
協(xié)議
訪問方法
file:///通過本地磁盤訪問。
http://與Apache組合,通過WebDAV協(xié)議訪問。
https://同上,但支持SSL協(xié)議加密連接。
svn://通過svnserve服務自定義的協(xié)議訪問。
svn+ssh://同上,但通過SSH協(xié)議加密連接。
在講解Subversion服務器安裝的同時,先介紹一下與Apache組合通過WebDAV方式訪問Subversion庫的方式:
首先要安裝好Apache2,并安裝好提供WebDAV訪問和svn訪問的的mod_dav模塊和mod_dav_svn模塊:
debian:~#apt-getinstallapache2libapache2-svn
配置文件位于/etc/apache2/mods-enabled/目錄下,配置文件共有兩個,分別是dav_svn.conf和dav_svn.load,dav_svn.load文件負責裝載必要的模塊,內(nèi)容如下:
#Loadmod_dav_svnwhenapachestarts
LoadModuledav_svn_module/usr/lib/apache2/modules/mod_dav_svn.so
LoadModuleauthz_svn_module/usr/lib/apache2/modules/mod_authz_svn.so
在裝載mod_dav_svn.so前,必須先裝載mod_dav.so模塊。它由dav.load文件控制,內(nèi)容如下:
LoadModuledav_module/usr/lib/apache2/modules/mod_dav.so
dav_svn.conf是mod_dav_svn.so模塊的配置文件,內(nèi)容如下:
#dav_svn.conf-ExampleSubversion/Apacheconfiguration
#
#FordetailsandfurtheroptionsseetheApacheusermanualand
#theSubversionbook.
#
#URLcontrolshowtherepositoryappearstotheoutsideworld.
#Inthisexampleclientsaccesstherepositoryashttp://hostname/svn/
#Uncommentthistoenabletherepository,
DAVsvn#啟用
#Setthistothepathtoyourrepository
SVNPath/data/subversion#設置儲存庫路徑,僅支持單個儲存庫,該路徑要可被Apache進程訪問。
#SVNParentPath/data/subversion#如果subversion下有多個儲存庫,則用SVNParentPath
#Thefollowingallowsforbasichttpauthentication.Basicauthentication
#shouldnotbeconsideredsecureforanyparticularlyrigorousdefinitionof
#secure.
#tocreateapasswdfile#按下面的步驟創(chuàng)建Apache用戶驗證文件
##rm-f/etc/apache2/dav_svn.passwd
##htpasswd2-c/etc/apache2/dav_svn.passwddwhedon
#Newpassword:
#Re-typenewpassword:
#Addingpasswordforuserdwhedon
##
#Uncommentthefollowing3linestoenableBasicAuthentication
AuthTypeBasic#啟用Apache基礎驗證
AuthName"SubversionRepository"#設置驗證框標題
AuthUserFile/etc/apache2/dav_svn.passwd#指定驗證用戶文件名
#UncommentthefollowinglinetoenableAuthzAuthentication
AuthzSVNAccessFile/etc/apache2/dav_svn.authz#啟用目錄級別授權,dav_svn.authz是授權配置文檔
#Thefollowingthreelinesallowanonymousread,butmake
#committersauthenticatethemselves.
#
Requirevalid-user
#
通過本文對Subversion服務器安裝的簡單介紹,相信你有所收獲。
【編輯推薦】
- 在subversion上完美安裝apache配置
- Subversion SVN協(xié)議解析遠程整數(shù)溢出漏洞
- 三大主流Subversion客戶端初探
- CentOS系統(tǒng)中安裝subversion并使用svn+ssh訪問
- CentOS安裝新版subversion