ITeye博客

安装subversion 1.7.4

jiangtie · 2013-06-25 11:47 · linux/unix · 编程语言 · Markdown

安装subversion 1.7.4

在Centos下面安装subversion1.7.4

1、需求软件


wget http://labs.mop.com/apache-mirror//apr/apr-1.4.6.tar.bz2
wget http://labs.mop.com/apache-mirror//apr/apr-util-1.4.1.tar.bz2
wget http://www.sqlite.org/sqlite-amalgamation-3071300.zip
wget http://apache.mirror.clusters.cc/subversion/subversion-1.7.4.tar.gz
wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
wget http://ftp.riken.go.jp/pub/FreeBSD/distfiles/bdb/db-5.3.21.tar.gz

2、安装db download db:http://www.linuxfromscratch.org/blfs/view/svn/server/db.html


cd db-5.3.21/build_unix
../dist/configure –prefix=/usr/local/services/db-5.3.21 –enable-compat185 –enable-dbm –disable-static –enable-cxx
make
make install

3、安装apr


./configure –prefix=/usr/local/services/apr-1.4.6
make
make install

4、安装apr-util


./configure –prefix=/usr/local/services/apr-util-1.4.1 –with-apr=/usr/local/services/apr-1.4.6 –with-berkeley-db=/usr/local/services/db-5.3.21
make
make install

5、安装neon


./configure –prefix=/usr/local/services/neon-0.29.6 –enable-shared
make
make install

6、安装zlib


cd /usr/local
wget  http://zlib.net/zlib-1.2.5.tar.gz
tar -xvzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure –prefix=/usr/local/services/zlib
make
make install

cd /usr/local/services/ 
ln -s zlib zlib

6、安装subversion


unzip sqlite-amalgamation-3071300.zip ; mv sqlite-amalgamation-3071300 sqlite-amalgamation
./configure –prefix=/usr/local/services/subversion-1.7.4 –with-apr=/usr/local/services/apr-1.4.6 –with-apr-util=/usr/local/services/apr-util-1.4.1 –with-neon=/usr/local/services/neon-0.29.6 –with-ssl –with-zlib=/usr/local/services/zlib –enable-maintainer-mode
make
make install

7、


ln -s /usr/local/services/subversion-1.7.4/bin/svn /usr/bin/svn
ln -s /usr/local/services/subversion-1.7.4/bin/svnadmin /usr/bin/svnadmin
ln -s /usr/local/services/subversion-1.7.4/bin/svnserve /usr/bin/svnserve
ln -s /usr/local/services/subversion-1.7.4/bin/svnlook /usr/bin/svnlook

如果最后运行svn报错的话 undefined symbol: apr_atomic_xchgptr 试试 yum install libapr1 可能会解决问题

最后附上一段自用的svn用户创建脚本


#!/bin/bash
RANDOM=`date –rfc-3339=ns|sed “s/\.0*\|+/\n/g”|sed -e 1d -e 3d`
RESULT=`htpasswd -nb $1 ${RANDOM}`

echo $RESULT | tr -s “[:]” “[=]” >> /svnroot/conf/passwd

echo “Create User ${1} ok !”

再附上一段自用的svn提交钩子


#!/bin/sh
export LANG=zh_CN.UTF-8

REPOS=”$1″
REV=”$2″

updateDir()
{
if [ "$1" != "0" ]; then
cd $2 > /dev/null
/usr/bin/svn up > /dev/null
/bin/chown -R nginx:nginx $2 > /dev/null
fi
}

AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS`
TIME=`/bin/date ‘+%F %T’`
COMMIT_FILES=`/usr/bin/svnlook changed -r $REV $REPOS`

echo “[$time]–[$author]–[$rev] svn commit:” >> /tmp/svn.log

修改了的文件列表


for updatePath in `echo $COMMIT_FILES | /bin/awk ‘{print $2}’`
do
echo $updatePath >> /tmp/svn.log
done

IS_BIRD_UPDATE=`echo $COMMIT_FILES | /bin/grep “server/trunk” | wc -l`
updateDir $IS_BIRD_UPDATE “/data/www/trunk

solve install error

  1. configure error 没有安装expat

configure: error: no XML parser was found: expat or libxml 2.x required

./configure --with-ssl (注意这步也会出现configure: error: no XML parser was found: expat or libxml 2.x required 这是因为还有一个包没有安装expat 可以 yun install expat* 直接安装, 安装完后在往下惊醒)

  1. install db error

checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/opt/subversion-1.7.10/db-5.3.21/build_unix':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

解决办法:出现该情况是由于c++编译器的相关package没有安装,以root用户登陆,在终端上执行:


# yum install glibc-headers*

# yum install gcc-c++*

这位同志使用的是红帽子版本,对于ubuntu来说,只需把yum改成apt-get即可。 但我自己并没有使用此方法,因为build-essential包含许多基本库,因此我决定尝试一把,输命令


#sudo apt-get install build-essential

再次运行./configure的时候成功通过~~

建议大家使用这种方法,因为它包含许多基本库,说不定让你已经安装其它软件时免除缺少各种库的烦恼。 reference:http://www.cnblogs.com/niocai/archive/2011/11/04/2236458.html

if install gcc-c++ error such as :


yum install gcc-c++
Error Downloading Packages:
  gcc-c++-4.4.7-3.el6.x86_64: failure: Packages/gcc-c++-4.4.7-3.el6.x86_64.rpm from base: [errno 256] No more mirrors to try.
  libstdc++-devel-4.4.7-3.el6.x86_64: failure: Packages/libstdc++-devel-4.4.7-3.el6.x86_64.rpm from base: [errno 256] No more mirrors to try.

then download and install by handle url: http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/libstdc++-4.4.7-3.el6.x86_64.rpm.html http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/libstdc++-devel-4.4.7-3.el6.x86_64.rpm.html


rpm -ivh libstdc++-devel-4.4.7-3.el6.x86_64.rpm 


2.centos下configure: error: Berkeley DB not found.的解决办法


[root@losapp opt]# yum install db4-devel*

download rpm: http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/db4-devel-4.7.25-17.el6.x86_64.rpm.html

3.#错误提示1# configure: error: We require OpenSSL; try --with-openssl

解决方法: 错误提示需要安装openssl,所以我就安装了一个openssl,安装方法如下: cd /usr/local wget http://www.openssl.org/source/openssl-1.0.0a.tar.gz tar -zxvf openssl-1.0.0a.tar.gz cd openssl-1.0.0a ./config ./config -t make depend make make test make install

安装之后会在/usr/local下生成一个ssl目录 设置环境变量,在/etc/profile的PATH中增加如下内容: PATH=/usr/local/ssl/bin:/sbin/:$PATH:/usr/sbin export PATH

ok,错误提示1解决。

重新执行./configure --with-openssl=/usr/local/ssl #这里加上--with-openssl参数 #错误提示2# configure: error: subversion requires zlib

解决方法: cd /usr/local wget http://zlib.net/zlib-1.2.5.tar.gz tar -xvzf zlib-1.2.5.tar.gz cd zlib-1.2.5 ./configure make make install

cd /usr/local ln -s zlib-1.2.5 zlib

ok,错误提示2解决。

重新执行./configure --with-openssl=/usr/local/ssl --with-zlib=/usr/local/zlib ,成功!

接着执行如下命令: make make install

ok,svn安装完成。

6.Berkeley DB version


如果最后出现下面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:
http://www.sleepycat.com/download/index.shtml

  1. svn --version error

svn  /usr/lib64/libz.so.1: no version information available (required by 

原因是zlib1.2.3的版本有问题, 需要升级即可。

解决办法: su使用root帐号, 执行删除命令:


rm /lib64/libz.so.1  /lib64/libz.so.1.2.3, 

复制文件: cp /ZLib_Home/lib/libz.so.1 /lib64/libz.so.1

复制文件: cp /Zlib_Home/lib/libz.so.1.x.x /lib64/libz.so.1.x.x

8.svn: SSL is not supported

仔细一看,原因如下,svn --version显示,ra_neon 不支持https :

  • ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
    • handles 'http' scheme 从网上查了一下,说是在执行./configure 时要加上--with-ssl ok,重新安装,如下: ./configure --with-openssl=/usr/local/ssl --with-zlib=/usr/local/zlib --with-ssl

reference: http://blaiu.iteye.com/blog/978037 http://www.jiongsun.com/2012/08/10.html http://hanqunfeng.iteye.com/blog/688295 http://blog.csdn.net/ie8848520/article/details/8145608

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。