Subversion system連線方式可分為三種:Apache + mod_dav_svn、svnserve、svnserver over SSH
其Client/Server運作圖大致如下:
相關文獻可參閱Subversion Online Documentation了解其運作原理。
本人則是使用Apache + mod_dav_svn模式進行連線,故須將mod_dav_svn package安裝。
其Client/Server運作圖大致如下:
本人則是使用Apache + mod_dav_svn模式進行連線,故須將mod_dav_svn package安裝。
Staging Environment Information:
Hardware And Operation System:
- OS:Red Hat Enterprise Linux 6.1 64 Bit
- CPU:1
- MEM:1 GB
- HDD:20 GB
- IP Address:192.168.188.101
Subversion System Installation Packages And Version List:
- subversion.x86_64:1.6.11-2.el6_0.3
- mod_dav_svn.x86_64:1.6.11-2.el6_0.3
- neon.x86_64:0.29.3-1.2.el6
- sqlite.x86_64:3.6.20-1.el6
- sqlite-devel.x86_64:3.6.20-1.el6
- Html Directory Path:/var/www/html/
- Apache Configure File Path:/etc/httpd/conf/httpd.conf
- Apache Authentication Configure File:/etc/htpasswd.user
- Subversion Apache Configure File Path:/etc/httpd/conf.d/subversion.conf
- SVN Parent Directory Path:/usr/local/svn/
使用yum指令進行安裝:
/usr/bin/yum install sqlite sqlite-devel /usr/bin/yum install neon /usr/bin/yum install subversion /usr/bin/yum install mod_dav_svn
安裝完畢後即可執行svnadmin create指令進行create repository並指定fs-type為fsfs,
後續將staging Directory使用者及群組更改為apache,以避免日後存取時出現"Access Denied"等錯誤訊息:
/bin/mkdir /usr/local/svn/ /usr/bin/svnadmin create --fs-type fsfs /usr/local/svn/staging /bin/chown -R apache:apache /usr/local/svn/staging在/tmp Directory建立staging Directory,並在其Directory建立trunk、branches、tags三個Directory。
使用svn import指令將staging Directory Import to staging repository,
Import完畢後可使用svn list指令list repository內容:
/bin/mkdir -p /tmp/Staging/{trunk,branches,tags}
/usr/bin/svn import -m "Initial trunk branches tags Folder" /tmp/Staging file:///usr/local/svn/staging
/usr/bin/svn list file:///usr/local/svn/staging
執行結果如下:[root@Subversion svn]# /usr/bin/svn import -m "Initial trunk branches tags Folder" /tmp/Staging file:///usr/local/svn/staging Adding /tmp/Staging/trunk Adding /tmp/Staging/branches Adding /tmp/Staging/tags Committed revision 1. [root@Subversion svn]# /usr/bin/svn ls file:///usr/local/svn/staging branches/ tags/ trunk/接下來為異動Subversion Apache Configure File,異動部分如下:
vi /etc/httpd/conf.d/subversion.conf
# Be sure that it comes before the mod_dav_svn line:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
# Appending the string of following:
<Location /svn/>
DAV svn
SVNParentPath /usr/local/svn
SVNListParentPath on
Order deny,allow
Deny from all
Satisfy any
AuthType Digest
AuthName "Subversion Reository"
AuthDigestDomain /svn
AuthUserFile /etc/htpasswd.user
# Read-Only Access
<Limit GET OPTIONS PROPFIND REPORT>
Require valid-user
</Limit>
# Write Access
<LimitExcept GET OPTIONS PROPFIND REPORT>
Require valid-user
</LimitExcept>
</Location>
Start Apache Daemon,並設定為開機則預先啟動:/etc/init.d/httpd start /sbin/chkconfig httpd on建立Authentication User File:
/usr/bin/htdigest -c /etc/htpasswd.user "Subversion Reository" godspeedyen /bin/chmod 400 /etc/htpasswd.user執行結果如下,[方框處]請自行變更密碼:
# Create Authentication User File [root@Subversion ~]# /usr/bin/htdigest -c /etc/htpasswd.user "Subversion Reository" godspeedyen Adding password for godspeedyen in realm Subversion Reository. New password: [godspeedyen] Re-type new password:[godspeedyen] # Change /etc/htpasswd.user File Permission [root@Subversion ~]# /bin/chmod 400 /etc/htpasswd.user # /etc/htpasswd.user File Format [root@Subversion ~]# /bin/cat /etc/htpasswd.user godspeedyen:Subversion Reository:823400fb0db41989ae173bfca3524015Finally, input SVN Server IP Address in Browser URL Path:http://192.168.188.101/svn/
Input account and password of /etc/htpasswd.user file:
And you will access staging repository successfully:
Reference Link:
- Apache Subversion Binary Packages
- Subversion Online Documentation
- Linux Subversion Server and Trac Server
- SVN 入門安裝設定教學(上)



沒有留言:
張貼留言