积微成著 不积跬步,无以至千里

首页   >   web开发   >   linux环境下svn二进制方式安装图文教程

linux环境下svn二进制方式安装图文教程

工作以来,使用的版本管理工具,最多的莫过于svn了,今天就来教大家如何在linux服务器上搭建svn,学会了之后,可以在自己的云服务器上搭建一个,方便自己平时做代码托管。

还是老习惯,下载任何东西,除非下载不到,否则直接去官网下载,svn官网下载地址:http://subversion.apache.org/download.cgi#recommended-release

linux环境下svn安装图文教程

跟jdk一样,也是超级多的版本,大家可以自己根据需要选择,这次就以 subversion-1.9.7 来做展示。

linux环境,我们直接使用wget命令

[root@VM_41_196_centos svn]# wget http://mirrors.shuosc.org/apache/subversion/subversion-1.9.7.tar.gz

使用tar命令,解压包

[root@VM_41_196_centos svn]# tar -zxvf subversion-1.9.7.tar.gz

上面两步,信息实在太多,刷了好几屏,所以就不放详细的细节了,如果机器环境没什么问题,基本上就是一路畅通,解压完毕之后,还是放到 /usr/local 下面,最终的目录结构是:/usr/local/svnlinux环境下svn安装图文教程

目录中有configure,那我们直接用它来配置一下路径什么的,这个命令,在 linux环境下nginx1.13.6二进制方式安装教程 中也有用到过

[root@VM_41_196_centos svn]# ./configure --prefix=/usr/local/svn
configure: Configuring Subversion 1.9.7
configure: creating config.nice
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/svn':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

哇,出师不利,上来就失败,没关系,又是缺少gcc这个鬼东西,写了这么多教程了,大家应该不陌生了,就不再多说了,我猜想是不是新买的服务器都没有一些软件环境,所以害得我每次都需要安装这些相关的组件库

[root@VM_41_196_centos svn]# yum install -y gcc

完了之后,我们再来执行

[root@VM_41_196_centos svn]# ./configure --prefix=/usr/local/svn
configure: Configuring Subversion 1.9.7
configure: creating config.nice
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking if gcc accepts -std=c90... yes
checking if gcc accepts -w... yes
checking if gcc accepts -Werror=unknown-warning-option... no
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking how to run the C preprocessor... gcc -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and configure Subversion
with the appropriate --with-apr option.

You probably need to do something similar with the Apache
Portable Runtime Utility (APRUTIL) library and then configure
Subversion with both the --with-apr and --with-apr-util options.

configure: error: no suitable APR found

查阅资料发现,原因是缺失了apr和apr-util库

[root@VM_41_196_centos local]# wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz

解压、配置、安装

[root@VM_41_196_centos local]# ./configure --prefix=/usr/local/apr
[root@VM_41_196_centos local]# make && make install

apr-util是依赖于apr的,所以apr需要先安装

[root@VM_41_196_centos local]# wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

解压、配置、安装

[root@VM_41_196_centos local]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@VM_41_196_centos local]# make && make install

日志信息实在是太多,这里就不贴了,我这是才购买的新机器,一次成功!

其中我们为了在编译过程中老是报错缺失依赖库,我们来个大杀手锏

[root@VM_41_196_centos local]# yum install zlib zlib-devel openssl openssl-devel –y

好了,我们再来执行之前svn的配置命令,这次我们给它指定我们安装的apr库

[root@VM_41_196_centos svn]# ./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
configure: Configuring Subversion 1.9.7
configure: creating config.nice
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking if gcc accepts -std=c90... yes
checking if gcc accepts -w... yes
checking if gcc accepts -Werror=unknown-warning-option... no
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking how to run the C preprocessor... gcc -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: Apache Portable Runtime (APR) library configuration
checking for APR... yes
checking APR version... 1.6.3
configure: Apache Portable Runtime Utility (APRUTIL) library configuration
checking for APR-util... yes
checking APRUTIL version... 1.6.1
checking for pkg-config... /usr/bin/pkg-config
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
configure: serf library configuration via pkg-config
checking for serf-2 library... no
checking for serf-1 library... no
checking was serf enabled... no

An appropriate version of serf could not be found, so libsvn_ra_serf
will not be built.  If you want to build libsvn_ra_serf, please
install serf 1.3.4 or newer.

configure: looking for apr_memcache as part of apr-util
checking apr_memcache.h usability... yes
checking apr_memcache.h presence... yes
checking for apr_memcache.h... yes
checking for apr_memcache_create in -laprutil-1... no
checking for Apache module support via DSO through APXS... no
==================================================================
WARNING: skipping the build of mod_dav_svn
         try using --with-apxs
==================================================================
configure: checking sqlite library
checking sqlite amalgamation... no
checking sqlite amalgamation... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite library version (via pkg-config)... no

An appropriate version of sqlite could not be found.  We recommmend
3.7.15.1, but require at least 3.7.12.
Please either install a newer sqlite on this system

or

get the sqlite 3.7.15.1 amalgamation from:
    http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unpack the archive using unzip and rename the resulting
directory to:
/usr/local/svn/sqlite-amalgamation

configure: error: Subversion requires SQLite

哎哟我去,还少东西,需要sqlite,看最下面的信息,连地址都给我们了,很人性化

[root@VM_41_196_centos local]# wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip

下载完了,直接copy到 /usr/local/svn 目录下

linux环境下svn二进制方式安装图文教程

再次执行,发现又报错缺少了expat,详细信息我就不贴出来了,错误大体都是一样的,直接在 http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download 下载了一个,目录如下:

linux环境下svn二进制方式安装图文教程

直接先configure,然后make

[root@VM_41_196_centos expat]# ./configure
[root@VM_41_196_centos expat]# make && make install
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmltok.lo -c lib/xmltok.c
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmlrole.lo -c lib/xmlrole.c
/bin/sh ./libtool --silent --mode=link gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -no-undefined -version-info 6:2:5 -rpath /usr/local/lib  -o libexpat.la lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlwf.o -c xmlwf/xmlwf.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlfile.o -c xmlwf/xmlfile.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/codepage.o -c xmlwf/codepage.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/unixfilemap.o -c xmlwf/unixfilemap.c
/bin/sh ./libtool --silent --mode=link gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H  -o xmlwf/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/unixfilemap.o libexpat.la
/bin/sh ./conftools/mkinstalldirs /usr/local/lib /usr/local/include
/bin/sh ./libtool --mode=install /usr/bin/install -c libexpat.la /usr/local/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.so.1.5.2 /usr/local/lib/libexpat.so.1.5.2
(cd /usr/local/lib && { ln -s -f libexpat.so.1.5.2 libexpat.so.1 || { rm -f libexpat.so.1 && ln -s libexpat.so.1.5.2 libexpat.so.1; }; })
(cd /usr/local/lib && { ln -s -f libexpat.so.1.5.2 libexpat.so || { rm -f libexpat.so && ln -s libexpat.so.1.5.2 libexpat.so; }; })
/usr/bin/install -c .libs/libexpat.lai /usr/local/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.a /usr/local/lib/libexpat.a
chmod 644 /usr/local/lib/libexpat.a
ranlib /usr/local/lib/libexpat.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
for FN in ./lib/expat.h ./lib/expat_external.h ; do /usr/bin/install -c -m 644 $FN /usr/local/include ; done
/bin/sh ./conftools/mkinstalldirs /usr/local/bin /usr/local/man/man1
mkdir /usr/local/man
mkdir /usr/local/man/man1
/bin/sh ./libtool --mode=install /usr/bin/install -c xmlwf/xmlwf /usr/local/bin/xmlwf
/usr/bin/install -c xmlwf/.libs/xmlwf /usr/local/bin/xmlwf
/usr/bin/install -c -m 644 ./doc/xmlwf.1 /usr/local/man/man1

完了之后,我们再次执行svn的configure命令

[root@VM_41_196_centos svn]# ./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

发现又缺少了zlib,但是在上面的大杀手锏里面,明明是安装了的

linux环境下svn二进制方式安装图文教程

回过头去仔细检查一番,原来在执行zlib安装的时候报错了,但是当时没有仔细看日志

Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:
       
         1. You have an upgrade for zlib which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of zlib of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude zlib.otherarch ... this should give you an error
            message showing the root cause of the problem.
       
         2. You have multiple architectures of zlib installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.
       
         3. You have duplicate versions of zlib installed already.
            You can use "yum check" to get yum show these errors.
       
       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).
       
       Protected multilib versions: zlib-1.2.7-17.el7.x86_64 != zlib-1.2.7-15.el7.i686

两个版本库冲突了,查资料找到了解决办法,在命令后面追加: --setopt=protected_multilib=false

[root@VM_41_196_centos svn]# yum install -y zlib zlib-devel openssl openssl-devel --setopt=protected_multilib=false

一遍下来,没什么问题了,我们再次执行之前的命令,可算是成功了,但是信息很多,这里只拖到最下面截一张图

linux环境下svn二进制方式安装图文教程

QQ群:积微成著官方群(686430774),验证消息:积微成著

站长Q:1347384268(加好友请注明来意)

分享到:

欢迎分享本文,转载请注明出处!

作者:不忘初心

发布时间:2017-11-13

永久地址:http://www.jiweichengzhu.com/article/0df98855305f4e2f97b6ac3a2f6306cb