最簡單的SVN (subversion)的配置

來源:互聯網
上載者:User

最簡單的SVN (subversion)的配置

for centos

by 花中神仙

系統:

  • Centos 5.0
  • Subversion 1.4.2

References:·
Subversion: http://subversion.tigris.org/
·
Version Control with Subversion: http://svnbook.red-bean.com/
安裝包和依賴包:

  • Subversion: RPM subversion-1.1.4-2.ent
  • Apache module: RPM mod_dav_svn-1.1.4-2.ent

1) 安裝:我們可以用rpm –qa | grep package(包名)查詢以下的包有沒有,如果沒有
就用yum install
package(包名)安裝就行,哈
這個很簡單。
[root@lucifer ~]# yum install mod_dav_svn subversionDependencies Resolved ============================================================================= Package
Arch
Version
Repository
Size=============================================================================Installing: mod_dav_svn
i386
1.1.4-2.ent
base
50 k subversion
i386
1.1.4-2.ent
base
1.6 MInstalling for dependencies: apr
i386
0.9.4-24.5.c4.1
base
88 k apr-util
i386
0.9.4-21
base
51 k guile
i386
5:1.6.4-14
base
746 k httpd
i386
2.0.52-22.ent.centos4
base

887 k httpd-suexec
i386
2.0.52-22.ent.centos4
base
28 k neon
i386
0.24.7-4
base
86 k perl-URI
noarch
1.30-4
base
79 k swig

i386
1.3.21-6
base
1.0 M umb-scheme
i386
3.2-35
base
967 k Transaction Summary=============================================================================Install
11 Package(s)Update
0 Package(s)Remove
0 Package(s)Total download size: 5.5 MIs this ok [y/N]:

2) 配置:a) Apache:這裡的不用配,預設就行:
[root@lucifer ~] vim /etc/httpd/conf/httpd.conf (按你的需要配,可以不用配)[root@lucifer ~] service httpd start[root@lucifer ~] chkconfig httpd on
http://IP
地址。http://網域名稱
可以訪問了。
b) SVN在apache中的配置:[root@lucifer ~] cd /etc/httpd/conf.d/[root@lucifer ~] vim subversion.conf # Make sure you uncomment the following if they are commented outLoadModule dav_svn_module
modules/mod_dav_svn.soLoadModule authz_svn_module
modules/mod_authz_svn.so# Add the following to allow a basic authentication and point Apache to where the actual# repository resides.<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
Require valid-user</Location>
可以直接修改成一樣的就行。
http://ip/repos
這樣你可以看到了。
下面是建立使用者:第一個和第二個命令不一樣,是因為第一個要建立新檔案。兩個命令不要輸反了,哈。如果你最後一次輸入第一個命令,不好意思,再重新一個一個的輸吧,在為這樣你的檔案裡只有一個使用者名稱,就是你最後一次輸的那一個,哈~~~。對了這裡密碼用的是MD5。
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusernameNew password:Re-type new password:Adding password for user yourusername[root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusernameNew password:Re-type new password:Adding password for user anotherusername[root@lucifer ~] service httpd restart
c)關於目錄的配置:
[root@lucifer ~] cd /var/www/ -- Or wherever you placed your path above[root@lucifer ~] mkdir svn[root@lucifer ~] cd svn[root@lucifer ~] svnadmin create repos[root@lucifer ~] chown -R apache.apache repos[root@lucifer ~] service httpd restart
這樣就建立了主目錄庫。
3)使用SVN:a) 結構:建立新的工程的時候最好是下面的結構,哈
.|-- project1|
|-- branches|
|-- tags|
`-- trunk`-- project2
|-- branches
|-- tags
`-- trunk


[root@lucifer ~] cd /tmp[root@lucifer ~] mkdir mytestproj[root@lucifer ~] cd mytestproj[root@lucifer ~] mkdir branches tags trunk[root@lucifer ~] vim branches/test.cfg -- Add whatever you want to these files.

b) import:[root@lucifer ~] svn import /tmp/mytestproj/ file:///var/www/svn/repos/mytestproj -m "Initial repository layout for mytestproj"Adding
/tmp/mytestproj/branchesAdding
/tmp/mytestproj/branches/test.cfgAdding
/tmp/mytestproj/tagsAdding
/tmp/mytestproj/trunk
c) Checking out:http://yourmachine/repos. 你訪問這個目錄下面就把那個目前下載下來了。
[me@mylappy ~] cd /tmp[me@mylappy ~] svn co http://IP/repos/mytestprojAuthentication realm: <http://yoursvnserver:80> Subversion reposPassword for 'youruser':A
mytestproj/branchesA
mytestproj/branches/test.cfgA
mytestproj/tagsA
mytestproj/trunk Checked out revision 1.
d) Edit and commit:當你修改後,再上傳。這樣版本號碼變了。
[me@mylappy ~] cd mytestproj[me@mylappy ~] vim branches/test.cfg -- Add or delete something and save.[me@mylappy ~] svn commit -m "Added a line to test.cfg."Sending
branches/test.cfgTransmitting file data .Committed revision 2.

e) Adding/deleting items:增加和刪除時。
[me@mylappy ~] svn co http://yoursvnserver/repos/mytestprojA
mytestproj/branchesA
mytestproj/branches/test.cfgA
mytestproj/tagsA
mytestproj/trunkChecked out revision 2. [me@mylappy ~] cd mytestproj[me@mylappy ~] cp /etc/yum.repos.d/CentOS-Base.repo branches/[me@mylappy ~] svn add branches/CentOS-Base.repoA
configurations/CentOS-Base.repo [me@mylappy ~] svn commit -m "Added the CentOS Yum repo file."Adding
configurations/CentOS-Base.repoTransmitting file data .Committed revision 3.

f) Reverting back:當恢複備份時。
[me@mylappy ~] svn log http://ip/repo -- For the entire repository[me@mylappy ~] svn log http://IP/repo/mytestproj -- For the specific project
我這樣查看可以看到現在的版本列表。都是那些改動了。
[me@mylappy ~] svn co -r 1 http://IP/repo/mytestproj Subversion.rar (8.66 KB)

下載次數: 1112007-8-27 15:30

這時我們在這裡選擇了版本號碼為1的曆史版本。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.