SVN 1.8版本的安裝與之前最大的不同是使用serf代替了neon. 而安裝serf 需要使用scons編譯工具,這個工具在編譯serf時,又需要使用openssl的庫,所以Openssl成了必須安裝的軟件.
1. 安裝openssl, 下載地址:https://www.openssl.org/source/
#tar zxvf openssl-1.0.2l.tar.gz
# cdopenssl-1.0.2l
# ./config --prefix=/usr/local/openssl
# make && make install
2. 安裝serf,下載地址:https://serf.apache.org/download
首先安裝編譯工具scons
#yun install -y scons
serf下載的是最新的1.3.9版本
# cd /usr/local
#tar jxvf serf-1.3.9.tar.bz2
#cd serf-1.3.9
# scons PREFIX=/usr/local/serf APR=/usr/local/apr APU=/usr/local/apr-util
#scons install
#scons -c
編譯SERF會遇到若干問題:
問題一:libevent找不到 openssl/bio.h的問題
解決方法:
#cd /usr/include
# ln -s /usr/local/openssl/include/openssl openssl
# ls -ld openssl
lrwxrwxrwx 1 root root 34 Jul 3 16:19 openssl -> /usr/local/openssl/include/openssl
問題二: /usr/bin/ld: can not find lssl serf
-lssl表示要尋找庫 libssl.so, 而上面的錯誤表示ld找不到這個庫,一般情況下,原因是系統中沒有安裝這個庫,只要安裝就好了。
#yum install -y openssl_devel
3.安裝SVN
[root@localhost subversion-1.8.17]# ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/usr/local/apache/bin/apu-1-config --with-sqlite=/usr/local/sqlite --with-serf=/usr/local/serf
編譯出錯:
svn: error while loading shared libraries: libserf-1.so.1: cannot open shared object file: No such file or directory
問題原因:The problem is that by default, the absolute path to any dynamically linked libraries in non-standard locations is not included in the final build. Assuming you are using Linux and gcc, you can either
1. fix the problem at compile time by passing additional flags to the linker to store the full path: prefix the configure command above with LDFLAGS="-Wl,-rpath,$HOME/Downloads/serf_install/lib"./configure..., or
2. fix the problem at runtime by executing export LD_LIBRARY_PATH="$HOME/Downloads/serf_install/lib:$LD_LIBRARY_PATH" before each use of svn or by adding it to your .bashrc file
The former solution is of course preferred, since it solves the problem at its root instead of providing band-aid.
解決方法:
[root@localhost subversion-1.8.17]# ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/usr/local/apache/bin/apu-1-config --with-sqlite=/usr/local/sqlite LDFLAGS="-Wl,-rpath --with-serf=/usr/local/serf
#make && make install
安裝完畢後:
#svn --version
svn: E200029: Couldn't perform atomic initialization
svn: E200030: SQLite compiled for 3.19.2, but running with 3.6.20
這是因爲編譯SVN用的sqlite 版本3.19.2和系統中已安裝的sqlite3.6.20版本不一致
#cd /usr/local/svn/bin
#ldd svn
從輸出中看出 libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00007f0f8572d000)
[root@localhost lib64]# find / -name libsqlite3.so.0 -print
/usr/local/sqlite/lib/libsqlite3.so.0
/usr/local/sqlite-autoconf-3190200/.libs/libsqlite3.so.0
/usr/local/lib/libsqlite3.so.0
/usr/lib64/libsqlite3.so.0
[root@localhost lib64]# mv libsqlite3.so.0 libsqlite3.so.0.old
[root@localhost lib64]# ln -s /usr/local/lib/libsqlite3.so.0 libsqlite3.so.0