现在的位置: 首页 > 综合 > 正文

Linux下安装更新svn

2012年09月12日 ⁄ 综合 ⁄ 共 3967字 ⁄ 字号 评论关闭

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 就可以了。

抱歉!评论已关闭.