hengheng123456789

            BlogJava :: 首頁 :: 聯(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)建一個新的儲存庫:

          #svnadmin create /svn/repository

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

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

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

          /data/ldap整個目錄導(dǎo)入到儲存庫中的repository目錄中,儲存庫的repository目錄會自動創(chuàng)建。

          顯示儲存庫內(nèi)容:

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

          .cache/

          .project

          .projectOptions

          .settings/

          bbscnmo/

          newcnmo/

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

          上面使用了file:///形式的URL來訪問Subversion庫,這表示在本地通過文件系統(tǒng)訪問。但我們的Subversion庫可能需要通過網(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

          # apt-get install apache2 libapache2-svn

          配置文件位于/etc/apache2/mods-enabled/目錄下,配置文件共有兩個,分別是dav_svn.confdav_svn.loaddav_svn.load文件負責(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è)置儲存庫路徑,僅支持單個儲存庫,該路徑要可被Apache進程訪問。

          #SVNParentPath /data/subversion #如果subversion下有多個儲存庫,則用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用戶驗證文件

          # # 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ǔ)驗證

          AuthName Subversion Repository #設(shè)置驗證框標題

          AuthUserFile /etc/apache2/dav_svn.passwd #指定驗證用戶文件名

          # Uncomment the following line to enable Authz Authentication

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

          # The following three lines allow anonymous read, but make

          # committers authenticate themselves.

          #

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

          Require valid-user

          #

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

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

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

          [groups] #定義組

          admin=jims,ringkee

          tests=tester1,tester2

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

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

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

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

          *= #禁止所有用戶訪問,星號代表所有用戶,權(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

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

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

          CGI方式運行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會自動重啟后,在svn的透視圖中可以看到svn的相關(guān)菜單

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

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

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

          posted on 2007-09-03 15:40 哼哼 閱讀(339) 評論(0)  編輯  收藏 所屬分類: JAVA-Common
          主站蜘蛛池模板: 永丰县| 沧源| 阳江市| 盖州市| 莫力| 杂多县| 邯郸县| 五大连池市| 虹口区| 汝阳县| 阜宁县| 双辽市| 中阳县| 高平市| 侯马市| 凤台县| 河北区| 府谷县| 通州区| 宜阳县| 锡林浩特市| 建阳市| 梓潼县| 方山县| 大庆市| 济宁市| 龙井市| 兴国县| 浪卡子县| 康平县| 柘荣县| 禹城市| 自治县| 綦江县| 英德市| 东平县| 哈密市| 桂东县| 梁山县| 财经| 延吉市|