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