2011/01/08

SVN on CentOS 5.5 i386

Ref:


1. Subvision on CentOS http://wiki.centos.org/HowTos/Subversion
2. http://www.ichiayi.com/wiki/tech/centosinstall


Quick Guide


=== My Guest OS (CentOS 5.5 i386)===


1. Install SVN



# yum install mod_dav_svn subversion
# vim /etc/httpd/conf.d/subversion.conf


---subversion.conf---
      :
LoadModule dav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module   modules/mod_authz_svn.so


<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn


   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL


      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /etc/svn-auth-conf
      Require valid-user
#   </LimitExcept>
</Location>
      :
---------------------



Notes:
1. http://server/svn/ will link to your /var/www/svn/
2. user shall be authorized 




2. Add users for svn


*** create AuthUserFile file (-c)

# htpasswd -c /etc/svn-auth-conf user0
New password: 
Re-type new password: 
Adding password for user user0



# cat /etc/svn-auth-conf 
user0:WAeUIXLH.ucGI



*** add new user

# htpasswd /etc/svn-auth-conf user1
New password: 
Re-type new password: 
Adding password for user user1


*** add new user w/o prompt

# htpasswd -b /etc/svn-auth-conf user4 user2pwd
Adding password for user user2




3. Create repos. 


# cd /var/www/
# mkdir svn
# cd svn
# svnadmin create Prj001
# chown -R apache.apache Prj001
# cd Prj001
# tree

.
|-- README.txt
|-- conf
|   |-- authz
|   |-- passwd
|   `-- svnserve.conf
|-- dav
|-- db
|   |-- current
|   |-- format
|   |-- fs-type
|   |-- revprops
|   |   `-- 0
|   |-- revs
|   |   `-- 0
|   |-- transactions
|   |-- uuid
|   `-- write-lock
|-- format
|-- hooks
|   |-- post-commit.tmpl
|   |-- post-lock.tmpl
|   |-- post-revprop-change.tmpl
|   |-- post-unlock.tmpl
|   |-- pre-commit.tmpl
|   |-- pre-lock.tmpl
|   |-- pre-revprop-change.tmpl
|   |-- pre-unlock.tmpl
|   `-- start-commit.tmpl
`-- locks
    |-- db-logs.lock
    `-- db.lock


8 directories, 23 files



# cd

# pwd
/root

# mkdir workspace
# cd workspace/
# mkdir prj1
# cd prj1/tree
# mkdir scr include lib
# echo "# hello" > main.c
# cd ..
# tree

.
`-- prj1
    |-- include
    |-- lib
    |-- main.c
    `-- scr


4 directories, 1 file

# cd prj1
# svn import . file:///var/www/svn/Prj001/ -m "Prj001 Original"
新增           include
新增           main.c
新增           lib
新增           scr

送交修訂版 1.

X. Don't forget to restart Apache

# /sbin/service httpd restart
# /sbin/chkconfig httpd on




=== My Host OS (Ubuntu 10.10)===



1. Check project from server



yenping@TenTen:~/svnwork$ svn co http://192.168.1.8/svn/Prj001
認證領域: <http://192.168.1.8:80> Authorization Realm
'yenping' 的密碼: ********
A    Prj001/include
A    Prj001/main.c
A    Prj001/lib
A    Prj001/scr
取出修訂版 1.



yenping@TenTen:~/svnwork$ tree
.
`-- Prj001
    |-- include
    |-- lib
    |-- main.c
    `-- scr


4 directories, 1 file


yenping@TenTen:~/svnwork$ cd Prj001/
yenping@TenTen:~/svnwork/Prj001$ svn log
------------------------------------------------------------------------
r1 | root | 2011-01-08 11:21:25 +0800 (六, 08  1月 2011) | 1 line

Prj001 Original
------------------------------------------------------------------------

2. Commit file

yenping@TenTen:~/svnwork/Prj001$ vim main.c 
yenping@TenTen:~/svnwork/Prj001$ svn diff
Index: main.c
===================================================================
--- main.c (revision 1)
+++ main.c (working copy)
@@ -1 +1,10 @@
-# hello
+//# hello
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+    printf("Hello SVN World.\n");
+
+}
+
yenping@TenTen:~/svnwork/Prj001$ svn ci -m"complete main()"
傳送           main.c
傳送檔案資料 .
送交修訂版 2.
yenping@TenTen:~/svnwork/Prj001$ svn log
------------------------------------------------------------------------
r1 | root | 2011-01-08 11:21:25 +0800 (六, 08  1月 2011) | 1 line

Prj001 Original
------------------------------------------------------------------------
yenping@TenTen:~/svnwork/Prj001$ svn update
於修訂版 2.
yenping@TenTen:~/svnwork/Prj001$ svn log
------------------------------------------------------------------------
r2 | yenping | 2011-01-08 11:43:57 +0800 (六, 08  1月 2011) | 1 line

complete main()
------------------------------------------------------------------------
r1 | root | 2011-01-08 11:21:25 +0800 (六, 08  1月 2011) | 1 line

Prj001 Original
------------------------------------------------------------------------
 :
 :
 :
(to be continued...)

沒有留言: