hengheng123456789

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            297 Posts :: 68 Stories :: 144 Comments :: 0 Trackbacks
           

          SVN Beginning

          http://blog.doesite.net/read.php?save_215

          1.安裝 subversion

          # apt-get install subversion subversion-tools

          創(chuàng)建一個(gè)新的儲(chǔ)存庫(kù):

          #svnadmin create /svn/repository

          /svn目錄創(chuàng)建一個(gè)新的空儲(chǔ)存庫(kù),數(shù)據(jù)儲(chǔ)存方式默認(rèn)采用Berkeley DB。

          導(dǎo)入你的源碼:

          # svn import /svn/repository file:///data/svn/ldap

          /data/ldap整個(gè)目錄導(dǎo)入到儲(chǔ)存庫(kù)中的repository目錄中,儲(chǔ)存庫(kù)的repository目錄會(huì)自動(dòng)創(chuàng)建。

          顯示儲(chǔ)存庫(kù)內(nèi)容:

          mt@mtmt:~$ svn list file:///svn/repository

          .cache/

          .project

          .projectOptions

          .settings/

          bbscnmo/

          newcnmo/

          顯示目錄內(nèi)容,成功導(dǎo)入。

          上面使用了file:///形式的URL來(lái)訪問Subversion庫(kù),這表示在本地通過文件系統(tǒng)訪問。但我們的Subversion庫(kù)可能需要通過網(wǎng)絡(luò)被其它用戶訪問,這就需要用到其它的協(xié)議,下表是Subversion支持的各種訪問協(xié)議:

          訪問協(xié)議

          協(xié)議 訪問方法

          file:/// 通過本地磁盤訪問。

          http:// Apache組合,通過WebDAV協(xié)議訪問。

          https:// 同上,但支持SSL協(xié)議加密連接。

          svn:// 通過svnserve服務(wù)自定義的協(xié)議訪問。

          svn+ssh:// 同上,但通過SSH協(xié)議加密連接。

          2.配置 subversion Apache組合通過WebDAV方式訪問Subversion庫(kù)

          # apt-get install apache2 libapache2-svn

          配置文件位于/etc/apache2/mods-enabled/目錄下,配置文件共有兩個(gè),分別是dav_svn.confdav_svn.load,dav_svn.load文件負(fù)責(zé)裝載必要的模塊,內(nèi)容如下:

          # Load mod_dav_svn when apache starts

          LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so

          LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so

          在裝載mod_dav_svn.so前,必須先裝載mod_dav.so模塊。它由dav.load文件控制,內(nèi)容如下:

          LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so

          dav_svn.confmod_dav_svn.so模塊的配置文件,內(nèi)容如下:

          # dav_svn.conf - Example Subversion/Apache configuration

          #

          # For details and further options see the Apache user manual and

          # the Subversion book.

          # …

          # URL controls how the repository appears to the outside world.

          # In this example clients access the repository as http://hostname/svn/

          #設(shè)置訪問路徑

          # Uncomment this to enable the repository,

          DAV svn #啟用by siko

          # Set this to the path to your repository

          SVNPath /data/subversion #設(shè)置儲(chǔ)存庫(kù)路徑,僅支持單個(gè)儲(chǔ)存庫(kù),該路徑要可被Apache進(jìn)程訪問。

          #SVNParentPath /data/subversion #如果subversion下有多個(gè)儲(chǔ)存庫(kù),則用SVNParentPath

          # The following allows for basic http authentication. Basic authentication

          # should not be considered secure for any particularly rigorous definition of

          # secure.

          # to create a passwd file #按下面的步驟創(chuàng)建Apache用戶驗(yàn)證文件

          # # rm -f /etc/apache2/dav_svn.passwd

          # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon

          # New password:

          # Re-type new password:

          # Adding password for user dwhedon

          # #

          # Uncomment the following 3 lines to enable Basic Authentication

          AuthType Basic #啟用Apache基礎(chǔ)驗(yàn)證

          AuthName Subversion Repository #設(shè)置驗(yàn)證框標(biāo)題

          AuthUserFile /etc/apache2/dav_svn.passwd #指定驗(yàn)證用戶文件名

          # Uncomment the following line to enable Authz Authentication

          AuthzSVNAccessFile /etc/apache2/dav_svn.authz #啟用目錄級(jí)別授權(quán),dav_svn.authz是授權(quán)配置文檔

          # The following three lines allow anonymous read, but make

          # committers authenticate themselves.

          #

          #允許匿名訪問,不允許Commit,不能與AuthzSVNAccessFile同時(shí)使用

          Require valid-user

          #

          修改/data/subversion目錄訪問權(quán)限使它可被Apache進(jìn)程訪問,我的Apache是用www-data啟動(dòng)的,所以設(shè)置方法如下:

          # chown -R www-data.www-data /data/subversion

          Apache的用戶驗(yàn)證功能可以區(qū)別匿名用戶和驗(yàn)證用戶,從而賦予匿名用戶讀權(quán)限和驗(yàn)證用戶讀/寫的權(quán)限。這些權(quán)限只能在全局范圍內(nèi)設(shè)置,不能設(shè)置具體 的某個(gè)目錄是否能被某個(gè)用戶操作。要實(shí)現(xiàn)目錄級(jí)別的授權(quán),就要使用mod_authz_svn.so模塊提供的 AuthzSVNAccessFile指令。它會(huì)指定一個(gè)授權(quán)文檔,該授權(quán)文檔設(shè)置具體的目錄權(quán)限。根據(jù)上面的配置,授權(quán)文檔名叫 dav_svn.authz,它的內(nèi)容如下:

          [groups] #定義組

          admin=jims,ringkee

          tests=tester1,tester2

          [erp:/] #定義erp儲(chǔ)存庫(kù)根目錄的訪問權(quán)限

          @admin=rw #admin組有讀寫權(quán)限

          tests=r #test用戶只有讀權(quán)限

          [oa:/test] #定義oa儲(chǔ)存庫(kù)下test目錄的訪問權(quán)限

          *= #禁止所有用戶訪問,星號(hào)代表所有用戶,權(quán)限為空代表沒有任何權(quán)限

          ringkee=rw #打開ringkee用戶的讀寫權(quán)限

          在該文件中使用的用戶需在apache2的用戶文件/etc/apache2/dav_svn.passwd中預(yù)先設(shè)置好。

          3.安裝trac #sudo apt-get install trac 配置TRAC

          #cd /trac/

          #trac-admin repository initenv

          在運(yùn)行trac-admin時(shí)有一步設(shè)置需要注意,就是”Path to repository”,要指向上面的/svn/repository

          chown -R www-data.www-data /trac/repository

          CGI方式運(yùn)行TRAC,有一些設(shè)置要做

          建立密碼文件:

          htpasswd -c /somewhere/trac.htpasswd username

          編輯apacheapache2.conf

          #edit by siko@ 2006.11.24

          ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi

          SetEnv TRAC_ENV “/trac/repository”

          Alias /tracdoc “/usr/share/trac/htdocs/”

          Options -Indexes -MultiViews

          AllowOverride None

          Order allow,deny

          Allow from all

          AuthType Basic

          AuthName “Trac”

          AuthUserFile /home/mt/trac.htpasswd

          Require valid-user

          重啟apache使其生效

          4. svneclipse插件 安裝配置:

          1.更新安裝http://subclipse.tigris.org/updatesubclipse插件

          2.安裝完成后eclipse會(huì)自動(dòng)重啟后,在svn的透視圖中可以看到svn的相關(guān)菜單

          3.將新的 SVN 資源庫(kù)添加至“SVN 資源庫(kù)。urlhttp://your_ip/svn

          4.引用項(xiàng)目成功后,便可以用前面的用戶名和密碼來(lái)更新和提交工程內(nèi)文件了。

          5.subclipse的較新版本都是中文的,詳細(xì)操作略。svn有很多的客戶端,在此只通過命令行來(lái)操作,結(jié)合eclipse的插件來(lái)控制版本并不涉及任何客戶端程序。

          posted on 2007-09-03 15:40 哼哼 閱讀(344) 評(píng)論(0)  編輯  收藏 所屬分類: JAVA-Common
          主站蜘蛛池模板: 独山县| 祁东县| 吉隆县| 浠水县| 阆中市| 土默特右旗| 深泽县| 礼泉县| 英德市| 鱼台县| 南宫市| 扶余县| 伊川县| 蒲江县| 老河口市| 吐鲁番市| 宁南县| 开封市| 高邮市| 务川| 美姑县| 民权县| 司法| 浏阳市| 抚顺市| 谢通门县| 奉节县| 牙克石市| 庆云县| 景洪市| 根河市| 诏安县| 龙川县| 贵定县| 丰镇市| 陵川县| 西青区| 海淀区| 贺兰县| 湟源县| 区。|