Centos 5.5 配置獨立的 Subversion 1.6.12 (SVN)伺服器 subversion(以下簡稱svn)是近年來崛起的版本管理工具,是cvs的接班人。
svn伺服器有2種運行方式:
1. 獨立伺服器
2. 藉助apache。
二種方式各有利弊,可以根據自己的需要進行配置,我不需要Http進行訪問,只需要用戶端可以Commit & update 就可以,下面是我選擇的第一種方式-獨立的SVN伺服器。
svn儲存版本資料也有2種方式:
1. BDB
2. FSFS。
因為BDB方式在伺服器中斷時,有可能鎖住資料(朋友在搞ldap時就深受其害,沒法根治),所以還是FSFS方式更安全一點,我也選擇這種方式。
我的系統內容:Centos-5.5 + Php-5.3.3 + Nginx-0.8.49 + Mysql-5.5.5m3+subersion-1.6.12
================================================================
============ 以上介紹系統完成,下面開始SVN安裝 ==============
================================================================
擷取svn安裝包,直接切換到root使用者進行所有操作:
最新版:
直接到下載頁面:
1 [root@hexu.org]$ wget http://subversion.tigris.org/downloads/subversion-deps-1.6.2.tar.gz
2 [root@hexu.org]$ wget http://subversion.tigris.org/downloads/subversion-1.6.2.tar.gz
下載完成之後,開始編譯:
1 [root@hexu.org]$ tar xfvz subversion-1.6.12.tar.gz
2 [root@hexu.org]$ tar xfvz subversion-deps-1.6.12.tar.gz
3 [root@hexu.org]$ cd subversion-1.6.12
4 [root@hexu.org]$ ./configure -–prefix=/usr/local/svn -–without-berkeley-db
註:以svnserve方式運行,不加apache編譯參數。以fsfs格式儲存版本庫,不編譯berkeley-db
如果最後出現下面WARNING,我們直接忽略即可。因為不使用BDB儲存。
configure: WARNING: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL. We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end. You can find the latest version of
Berkeley DB here:
編譯完成之後,開始安裝:
1 [root@hexu.org]$ make && make install
如果 make install 出現下面錯誤:
error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
解決辦法:
01 #1、編輯/etc/ld.so.conf檔案:
02 [root@hexu.org]$ vi /etc/ld.so.conf
03 # 添加下面一行
04 /usr/local/lib
05
06 #2、儲存後運行ldconfig。
07 [root@hexu.org]$ /sbin/ldconfig
08
09 #3、再重新運行make install 問題得到解決。
10 [root@hexu.org]$ make install
11
12 #註:ld.so.conf和ldconfig用於維護系統動態連結程式庫
測試是否安裝成功:
1 [root@hexu.org]$ /usr/local/svn/bin/svnserve --version
如果顯示如下,svn安裝成功:
svnserve, version 1.6.12 (r955767)
compiled Sep 1 2010, 01:36:17
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet ().
The following repository back-end (FS) modules are available:
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
================================================================
============ 為了方便下操作,下面將SVN的BIN添加到PATH ====================
================================================================
在/etc/profile最後加入 SVN Path 以方便操作:
01 #1、編輯/etc/profile檔案,添加PATH
02 [root@hexu.org]$ vi /etc/profile
03 #比如像下面這樣添加:
04 PATH=/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/svn/bin:$PATH
05
06 #添加完成執行,馬上生效:
07 [root@hexu.org]$ source /etc/profile
08
09 #測試查看設定是否成功
10 [root@hexu.org]$ echo $PATH
11 /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/svn/bin:......
12 #上面已經包含了“/usr/local/svn/bin”,說明已經成功。
================================================================
================= 安裝時可能遇到的問題 ====================
================================================================
1. 如在make時,報錯/usr/lib/libexpat.so: could not read symbols: File in wrong format
請在configure時,帶上參數--with-expat=builtin
2.
checking zlib.h usability ... no checking zlib.h presence ... no checking zlib.h...
checking zlib.h usability ... no
checking zlib.h presence ... no
checking zlib.h... no
configure: error: subversion requires zlib
解決
[root@136199 ~]# cd /usr/ali/subversion-1.6.2
[root@136199 subversion-1.6.2]# cd zlib/
[root@136199 zlib]# ./configure --shared
[root@136199 zlib]# make
[root@136199 zlib]# cd ..
[root@136199 subversion-1.6.2]# [root@136199 subversion-1.6.2]# ./configure CPPFLAGS="-Izlib/ -Lzlib/" --with-openssl=/usr/bin/openssl --without-serf
openssl的參數是為瞭解決找不到openssl的問題
3. make時報如下錯誤 /usr/bin/ld: cannot find lz 解決:安裝 zlibdevel.i386
make時報如下錯誤
/usr/bin/ld: cannot find lz
解決:安裝 zlib-devel.i386
4. svn: Unrecognized URL scheme for '
svn: Unrecognized URL scheme for 'http://svn.alibaba-inc.com/repos/ali_intl/apps'
這是svn以webdav協議訪問的時候需要 neon庫,我們需要安裝這個,可以在subversion的原始碼目錄中,將下載的neon展開,並且目錄名稱命名為neon。
1)、wget http://www.webdav.org/neon/neon-0.25.5.tar.gz
2)、tar -xvzf neon-0.25.5.tar.gz
3)、mv neon-0.25.5 neon
然後 編譯subversion 就可以了。