程式碼的版本控制除了之前介紹的 CVS Server in Linux & Jdeveloper OAF in Window 開發環境的整合設定 ,還有功能較為強大的 SVN Server ( Subversion ),相信這兩個程式版本控制服務應該可以符合大部份開發人員對於版本控制的要求了。若是想架設在 Windows 平台的話,可以參考 Apache/2.0.59 (Win32) 與 SVN/1.4.3 的安裝 & Apache/2.0.59 (Win32) 與 SVN/1.4.3 對 AD 的認證  。

環境:

Oracle Linux:Oracle Linux Release 6 Update 5 for x86_64 (64 Bit)
    host: oradb12clinux
    ip: 192.168.3.50

SVN Server ( Subversion ):subversion-svn2cl-1.6.11-9.el6_4.noarch

Apache Server:1.6.11-9:httpd-2.2.15-26.0.1.el6.x86_64

認證套件:mod_dav_svn-1.6.11-9.el6_4.x86_64

Windows AD:Windows Server 2003    host: adserver.wei.com
    ip: 192.168.2.1

 Windows Client :TortoiseSVN

一、安裝相關套件

 svn_package  

# rpm -qa | grep httpd
httpd-tools-2.2.15-26.0.1.el6.x86_64
httpd-2.2.15-26.0.1.el6.x86_64
httpd-manual-2.2.15-26.0.1.el6.noarch

# rpm -qa | grep svn
mod_dav_svn-1.6.11-9.el6_4.x86_64
git-svn-1.7.1-3.el6_4.1.noarch
ltrace-0.5-23.45svn.el6.x86_64
subversion-svn2cl-1.6.11-9.el6_4.noarch

二、建立 SVN Server ( Subversion ) 的 repository 與權限設定

1) 執行 # svnadmin create /opt/svn_root/ebs_source , 這是為了要建立 SVN Server 的 repository

# svnadmin create /opt/svn_root/ebs_source
# ls -al ebs_source/
total 32
drwxr-xr-x. 6 root root 4096 Jan 17 11:08 .
drwxr-xr-x. 3 root root 4096 Jan 17 11:08 ..
drwxr-xr-x. 2 root root 4096 Jan 17 11:08 conf
drwxr-sr-x. 6 root root 4096 Jan 17 11:08 db
-r--r--r--. 1 root root    2 Jan 17 11:08 format
drwxr-xr-x. 2 root root 4096 Jan 17 11:08 hooks
drwxr-xr-x. 2 root root 4096 Jan 17 11:08 locks
-rw-r--r--. 1 root root  229 Jan 17 11:08 README.txt

 

2) 執行 htpasswd 建立檔案型認證檔:passwd ,新增使用者 polinwei & u01
# htpasswd -c /opt/svn_root/ebs_source/conf/passwd polinwei ==> passwd 檔案不在時, htpasswd 參數要下 -c
New password:
Re-type new password:
Adding password for user polinwei

# htpasswd /opt/svn_root/ebs_source/conf/passwd u01 ==> passwd 檔案己存在時, htpasswd 參數不要下 -c
New password:
Re-type new password:
Adding password for user u01

# cat /opt/svn_root/ebs_source/conf/passwd
polinwei:rOocF4eiWllRQ
u01:VHkwsuykRzVlM

3) 維護 Repository:ebs_source 的存取權限

# vi /opt/svn_root/ebs_source/conf/authz
[groups]
admins = polinwei
users  = u01
oracle_ebs_group = polinwei

[ebs_source:/] ==> 這就是 repository 的根目錄
* = r
@admins = rw
@oracle_ebs_group = rw
@users = r

#可以對每個 repository 下的目錄再作權限管理

[ebs_source:/wei]
@oracle_ebs_group = rw

[ebs_source:/test]
@admins = rw
@users = r

 4) svnserve.conf 設定檔原則上是可以不需修改,使用預設值即可

 

二、設定 apache 對 SVN Server ( Subversion ) 的存取權限

1)  編輯 Apache 的 httpd.conf

因檔案 /etc/httpd/conf/httpd.conf 中有  Include conf.d/*.conf 

# vi /etc/httpd/conf/httpd.conf
#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

所以只要編輯  /etc/httpd/conf.d/subversion.conf

# vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

# 對 SVN Respository : ebs_source 作設定
<Location /ebs_source>
   DAV svn
   SVNPath /opt/svn_root/ebs_source
   AuthType Basic
   AuthName "Subversion repository"
   AuthzSVNAccessFile /opt/svn_root/ebs_source/conf/authz
   AuthUserFile /opt/svn_root/ebs_source/conf/passwd
   Require valid-user
</Location>

2) 變更 SVN Respository : ebs_source 實體目錄權限

# chown -R apache.apache ebs_source
# chcon -R -t httpd_sys_content_t ebs_source

3) 重啟 Apache 服務,與測試;網址應為 http://oradb12clinux/ebs_source/

# service httpd restart


svn_jdeveloper_client.png  

三、SVN Server ( Subversion ) 的存取權限與 Windows AD 帳號/密碼作整合

1) 將檔案型:認證密碼檔 passwd 前加 #,並設定對 Windows AD 以 LDAP 加 SSL 作認證

# vi /etc/httpd/conf.d/subversion.conf

<Location /ebs_source>
   DAV svn
   SVNPath /opt/svn_root/ebs_source
   AuthType Basic
   AuthName "Subversion repository"
   AuthzSVNAccessFile /opt/svn_root/ebs_source/conf/authz
#   AuthUserFile /opt/svn_root/ebs_source/conf/passwd
   Require valid-user

   SSLRequireSSL
   AuthzLDAPAuthoritative Off
   AuthLDAPURL ldap://adserver.wei.com:389/o=wei?cn?sub
   AuthBasicProvider ldap
</Location>

2) 維護 Repository:ebs_source 的存取權限

# vi /opt/svn_root/ebs_source/conf/authz
[groups]
admins = polinwei
users  = u01
oracle_ebs_group = polinwei,polin.wei

[ebs_source:/] ==> 這就是 repository 的根目錄
* = r
@admins = rw
@oracle_ebs_group = rw

#可以對每個 repository 下的目錄再作權限管理,注意:若目錄下權限群組名:oracle_ebs_group 沒定對時,會造成所有人沒有權限進入repository 的根目錄

[ebs_source:/wei]
@oracle_ebs_group = rw

[ebs_source:/test]
@admins = rw
@users = r

 

3) 重啟 Apache 服務,與測試;注意網址變為 https (port:443 SSL協定) https://oradb12clinux/ebs_source/ ;認證則為 windows AD 裡的帳號/密碼

# service httpd restart

 svn_ad_user_auth.png  

 

 

arrow
arrow
    文章標籤
    linux SVN Subversion AD
    全站熱搜

    MIS 發表在 痞客邦 留言(0) 人氣()