参考文献:
http://davinci.csie.ntu.edu.tw/brent/space/Subversion
http://www.juee.com.tw/bartender/svn-present/svn-wsad.htm
http://www.juee.com.tw/bartender/svn-present/svn-share-forder.htm
http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39210880,00.htm
http://svn.webdav.org/repos/projects/subwiki/trunk/INSTALL.html
相关教程:
http://freebsd.sinica.edu.tw/~plasma/svnbook/book.html
http://svnbook.red-bean.com/svnbook/book.html
多年来,并发版本系统(CVS)一直是在Linux上管理代码或者文本的标准。作为基于RCS上建立但却允许多用户协作的系统而言,CVS记录所有文件的修改信息。这对于程序开发者、网络设计者和系统管理员而言,是非常有用的。
然而,CVS逐渐显示出它的衰老,出现了相似的源代码管理软件。然而大多这种东西都是以牟利为主要目的的。
Subversion就是一种相对新鲜的源代码管理系统。虽然事实上它还在不断的反展之中,但是Subversion已经是一个非常稳定而且成熟的产品。它是一个全新的系统,其功能可以和CVS媲美,同时,它要比CVS更直观,更容易操作。
你可以通过多种方法来查阅Subversion的知识库:通过本地文件、svn协议、Apache2 或WebDAV。我们建议使用Apache2和WebDAV来安装,这样,多用户就可以访问并修改数据。
为了创建一个Subversion 的知识库,使用svnadmin,如下所示:
$ svnadmin /usr/local/subversion
你可以在Subversion 中导入文件,这个操作和在CVS中的一样,如下所示:
$ svn import -m "log msg" /home/user/import file:///usr/local/subversion
这条语句将把路径/home/user/import下找到的文件导入到你开始创建的Subversion 知识库中去。如果你已经在CVS中操作过,你可以从Subversion的主页上(Subversion
home page)下载一个开发脚本,叫做cvs2svn.py,然后把它导入到Subversion中,并保留它的历史记录。
环境Redhat linux 9.0
下载地址
http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/
[root@linux root]# cd /usr/local/src/
[root@linux src]# mkdir subversion
[root@linux src]# cd subversion
[root@linux subversion]#
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-0.9.5-0.2.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-devel-0.9.5-0.2.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-util-0.9.5-0.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-util-devel-0.9.5-0.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-0.24.6-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-debuginfo-0.24.6-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-devel-0.24.6-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/swig-1.3.19-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-devel-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-manual-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_perl-1.99_09-10.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_perl-devel-1.99_09-10.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_python-3.0.3-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_ssl-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-devel-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-domxml-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-imap-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-ldap-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-mysql-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-odbc-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-pgsql-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-snmp-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-xmlrpc-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/rapidsvn-0.5.0-7013.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/rapidsvn-debuginfo-0.5.0-7013.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-debuginfo-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-devel-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-gl-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-static-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-debuginfo-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-devel-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-perl-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-python-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-server-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-tools-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/cvs2svn-0.1-821.noarch.rpm
安装RPM包:
[root@linux subversion]# rpm -Uvh apr-*
Preparing... ########################################### [100%]
1:apr ########################################### [ 25%]
2:apr-devel ########################################### [ 50%]
3:apr-util ########################################### [ 75%]
4:apr-util-devel ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh neon-*
Preparing... ########################################### [100%]
1:neon-devel ########################################### [ 33%]
2:neon ########################################### [ 67%]
3:neon-debuginfo ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh swig-1.3.19-1.1.i386.rpm
Preparing... ########################################### [100%]
warning: user david does not exist - using root
1:swig ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -e php-mysql-4.2.2-17 php-pgsql-4.2.2-17
php-odbc-4.2.2-17
[root@linux subversion]# rpm --erase mod_perl-1.99_07-5 mod_python-3.0.1-3
php-4.2.2-17 mod_auth_mysql-1.11-12 mod_auth_pgsql-0.9.12-14 php-imap-4.2.2-17
php-ldap-4.2.2-17
[root@linux subversion]# rpm -e mod_ssl-2.0.40-21
[root@linux subversion]# rpm -Uvh httpd-*
Preparing... ########################################### [100%]
1:httpd warning: /etc/httpd/conf/httpd.conf created as /etc/httpd/conf/httpd.conf.rpmnew
########################################### [ 33%]
2:httpd-devel ########################################### [ 67%]
3:httpd-manual ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# cd /etc/httpd/conf/
[root@linux conf]# ls
httpd.conf httpd.conf.rpmnew magic Makefile ssl.crl ssl.crt ssl.csr
ssl.key ssl.prm
[root@linux conf]# mv httpd.conf httpd.conf.OFF
httpd.conf.OFF httpd.conf.rpmnew magic Makefile ssl.crl ssl.crt ssl.csr
ssl.key ssl.prm
[root@linux conf]# cp httpd.conf.rpmnew httpd.conf
[root@linux conf]# cd -
[root@linux subversion]# rpm -Uvh mod_*
Preparing... ########################################### [100%]
1:mod_perl ########################################### [ 25%]
2:mod_perl-devel ########################################### [ 50%]
3:mod_python ########################################### [ 75%]
4:mod_ssl ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh php-*
Preparing... ########################################### [100%]
1:php ########################################### [ 10%]
2:php-devel ########################################### [ 20%]
3:php-domxml ########################################### [ 30%]
4:php-imap ########################################### [ 40%]
5:php-ldap ########################################### [ 50%]
6:php-mysql ########################################### [ 60%]
7:php-odbc ########################################### [ 70%]
8:php-pgsql ########################################### [ 80%]
9:php-snmp ########################################### [ 90%]
10:php-xmlrpc ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh wxGTK-*
Preparing... ########################################### [100%]
1:wxGTK ########################################### [ 20%]
2:wxGTK-debuginfo ########################################### [ 40%]
3:wxGTK-devel ########################################### [ 60%]
4:wxGTK-gl ########################################### [ 80%]
5:wxGTK-static ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh subversion-*
Preparing... ########################################### [100%]
1:subversion ########################################### [ 14%]
2:subversion-debuginfo ###########################################
[ 29%]
3:subversion-devel ########################################### [ 43%]
4:subversion-perl ########################################### [ 57%]
5:subversion-python ########################################### [
71%]
6:subversion-server ########################################### [
86%]
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
7:subversion-tools ########################################### [100%]
[root@linux subversion]#
[root@linux subversion]# rpm -Uvh rapidsvn-*
Preparing... ########################################### [100%]
1:rapidsvn-debuginfo ########################################### [
50%]
2:rapidsvn ########################################### [100%]
[root@linux subversion]#
大功告成。
测试
[root@linux subversion]# mkdir test
[root@linux subversion]# cd test/
[root@linux test]# svn checkout http://svn.webdav.org/repos/projects/subwiki/trunk
subwiki
A subwiki/install-subwiki
A subwiki/plugins
A subwiki/plugins/ext
A subwiki/plugins/ext/history.py
A subwiki/plugins/ext/interwiki.py
A subwiki/plugins/std
A subwiki/plugins/std/view.py
A subwiki/plugins/std/patterns.py
A subwiki/plugins/std/macros.py
A subwiki/plugins/std/change.py
A subwiki/plugins/std/_stdutil.py
A subwiki/tests
A subwiki/tests/README
A subwiki/tests/dev
A subwiki/tests/dev/test-db.py
A subwiki/tests/dev/README
A subwiki/conf
A subwiki/conf/subwiki.conf.dist
A subwiki/conf/layouts.conf
A subwiki/LICENSE.html
A subwiki/lib
A subwiki/lib/ezt.py
A subwiki/lib/subwiki
A subwiki/lib/subwiki/wikiize.py
A subwiki/lib/subwiki/util.py
A subwiki/lib/subwiki/indexer.py
A subwiki/lib/subwiki/__init__.py
A subwiki/lib/subwiki/setup.py
A subwiki/lib/subwiki/install.conf
A subwiki/lib/subwiki/main.py
A subwiki/lib/subwiki/config.py
A subwiki/lib/subwiki/handler
A subwiki/lib/subwiki/handler/h_cgi.py
A subwiki/lib/subwiki/handler/base.py
A subwiki/lib/subwiki/handler/cmdline.py
A subwiki/lib/subwiki/handler/__init__.py
A subwiki/COMMITTERS
A subwiki/scripts
A subwiki/scripts/cmdline.py
A subwiki/scripts/make-release.sh
A subwiki/scripts/run-indexer.py
A subwiki/scripts/subwiki
A subwiki/scripts/subwiki.cgi
A subwiki/INSTALL.html
A subwiki/templates
A subwiki/templates/runtime
A subwiki/templates/runtime/footer.ezt
A subwiki/templates/runtime/history.ezt
A subwiki/templates/runtime/edit.ezt
A subwiki/templates/runtime/header.ezt
A subwiki/templates/runtime/add.ezt
A subwiki/templates/runtime/view.ezt
A subwiki/templates/on-disk
A subwiki/templates/in-repos
A subwiki/templates/in-repos/pages
Checked out revision 164.
[root@linux test]#
创建svn仓库:
[root@linux test]# svnadmin create /home/chen/subversion
[root@linux test]# cd /home/chen/subversion
配置 subversion 服务器
[root@linux test]# vi /home/chen/subversion/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
### [users]
### USERNAME = PASSWORD
# password-db = passwd
realm = /home/chen/subverson
启动守护进程
[root@linux test]# svnserve -d -r /home/chen/subversion
[root@linux test]# ps ax |grep svnserve
2736 ? S 0:00 svnserve -d -r /home/chen/subversion
2741 pts/1 S 0:00 grep svnserve
[root@linux test]#
Checkout 文档
Schema 存取方法
file:/// 直接存取檔案庫 (位於本地端磁碟上)
http:// 經由 WebDAV 通?協定, 連接到知曉 Subversion 的 Apache 伺服器.
https:// 與 http:// 相同, 但是有 SSL 加密.
svn:// 經由自訂通?協定的未授權 TCP/IP 連線, 連接到svnserve 伺服器.
svn+ssh:// 經由自訂通?協定的已認證加密 TCP/IP 連線, 連接到 svnserve 伺服器
svn://主机/目录
[root@linux test]# svn checkout svn://localhost/
Apache WebDAV 的配置
[root@linux root]# cd /etc/httpd/conf.d/
[root@linux conf.d]#
[root@linux conf.d]# vi subversion.conf
[root@linux conf.d]# cat subversion.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so <Location
/svn/repos>
DAV svn
SVNPath /home/svnroot
#
# # 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 /absolute/path/to/passwdfile
# Require valid-user </LimitExcept> </Location>
[root@linux conf.d]#
重新启动Aapche
[root@linux conf.d]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@linux conf.d]#
测试
[root@linux conf.d]# cd /tmp/
[root@linux tmp]#
[root@linux httpd]# svn checkout http://192.168.0.1/svn
http://192.168.0.1/svn/ |