CentOS7.2 编译安装SVN1.9.5客户端
背景
原来想在Linux机上开Samba共享,在Windows机上把工作目录映射到网络驱动器,用Source Insight编辑代码后就不用来回同步文件了。
然而在使用中发现,Windows机用的SVN客户端版本是1.9.4,而CentOS自带的版本是1.7.14。
用Windows更新过SVN Work Directory后,一不小心就更到了SVN1.8版格式(应该可以选不更新格式吧?)
这样弄完,Linux机上就无法使用SVN了(使用1.7版格式,提示客户端版本太旧)。
网上搜RPM包但是CentOS木有更新的版本了,无奈只好琢磨编译安装最新版!这样两个平台都用1.9版的,就应该没问题了!
环境
[root@min-base ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
且是Minimal Install
安装
主要参考官网的安装说明,这里没有研究最小依赖安装环境,不过也挺小的了。
安装开发环境工具
[root@min-base ~]# yum -y groupinstall "Deveolpment tools"
这里也会把svn客户端安上,但是是1.7.14版本的,移除它
[root@min-base ~]# yum -y remove subversion
根据安装说明,这里需要几个依赖
安装依赖
[root@min-base ~]# yum -y install yum install python-devel zlib openssl openssl-devel file-libs libtool libtool-devel
查看版本
[root@min-base ~]# rpm -qa | grep autoconf autoconf-2.69-11.el7.noarch [root@min-base ~]# rpm -qa | grep libtool libtool-2.4.2-21.el7_2.x86_64 [root@min-base ~]# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) Copyright (C) 2015 Free Software Foundation, Inc.
下载svn源码包
[root@min-base ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/subversion/subversion-1.9.5.tar.gz [root@min-base ~]# tar zxvf subversion-1.9.5.tar.gz [root@min-base ~]# cd subversion-1.9.5 [root@min-base subversion-1.9.5]# ll -rw-rw-r--. 1 1000 1000 2032 Mar 11 2013 aclocal.m4 -rwxrwxr-x. 1 1000 1000 7726 Jul 27 2015 autogen.sh -rw-rw-r--. 1 1000 1000 94 Feb 23 2010 BUGS drwxrwxr-x. 6 1000 1000 4096 Nov 21 21:57 build -rw-rw-r--. 1 1000 1000 48346 Jun 24 2015 build.conf -rw-rw-r--. 1 1000 1000 850308 Nov 21 21:57 build-outputs.mk -rw-rw-r--. 1 1000 1000 325464 Nov 21 21:07 CHANGES -rw-rw-r--. 1 1000 1000 14126 Jan 26 2015 COMMITTERS -rwxrwxr-x. 1 1000 1000 877735 Nov 21 21:57 configure -rw-rw-r--. 1 1000 1000 55079 Nov 17 12:00 configure.ac drwxrwxr-x. 4 1000 1000 66 Nov 21 21:57 doc -rw-rw-r--. 1 1000 1000 23 Nov 21 21:57 gen-make.opts -rwxrwxr-x. 1 1000 1000 10988 May 14 2015 gen-make.py -rwxrwxr-x. 1 1000 1000 4859 Aug 4 12:00 get-deps.sh -rw-rw-r--. 1 1000 1000 58579 Dec 12 2015 INSTALL -rw-rw-r--. 1 1000 1000 19889 Jan 30 2015 LICENSE -rw-rw-r--. 1 1000 1000 40217 Dec 10 2015 Makefile.in -rw-rw-r--. 1 1000 1000 1132 Apr 21 2016 NOTICE -rw-rw-r--. 1 1000 1000 2303 Jun 1 2016 README drwxrwxr-x. 36 1000 1000 4096 Nov 21 21:57 subversion drwxrwxr-x. 14 1000 1000 4096 Nov 21 21:57 tools -rw-rw-r--. 1 1000 1000 41944 Dec 7 2015 win-tests.py
使用自带脚本下载svn依赖(前面加了===的为get-deps.sh脚本下载的依赖)
[root@min-base subversion-1.9.5]# ./get-deps.sh [root@min-base subversion-1.9.5]# ll -rw-rw-r--. 1 1000 1000 2032 Mar 11 2013 aclocal.m4 ===drwxr-sr-x. 25 5000 10001 4096 Feb 8 2012 apr ===drwxr-xr-x. 19 500 1000 4096 Sep 8 2012 apr-util -rwxrwxr-x. 1 1000 1000 7726 Jul 27 2015 autogen.sh -rw-rw-r--. 1 1000 1000 94 Feb 23 2010 BUGS drwxrwxr-x. 6 1000 1000 4096 Nov 21 21:57 build -rw-rw-r--. 1 1000 1000 48346 Jun 24 2015 build.conf -rw-rw-r--. 1 1000 1000 850308 Nov 21 21:57 build-outputs.mk -rw-rw-r--. 1 1000 1000 325464 Nov 21 21:07 CHANGES -rw-rw-r--. 1 1000 1000 14126 Jan 26 2015 COMMITTERS -rwxrwxr-x. 1 1000 1000 877735 Nov 21 21:57 configure -rw-rw-r--. 1 1000 1000 55079 Nov 17 12:00 configure.ac drwxrwxr-x. 4 1000 1000 66 Nov 21 21:57 doc -rw-rw-r--. 1 1000 1000 23 Nov 21 21:57 gen-make.opts -rwxrwxr-x. 1 1000 1000 10988 May 14 2015 gen-make.py -rwxrwxr-x. 1 1000 1000 4859 Aug 4 12:00 get-deps.sh -rw-rw-r--. 1 1000 1000 58579 Dec 12 2015 INSTALL -rw-rw-r--. 1 1000 1000 19889 Jan 30 2015 LICENSE -rw-rw-r--. 1 1000 1000 40217 Dec 10 2015 Makefile.in -rw-rw-r--. 1 1000 1000 1132 Apr 21 2016 NOTICE -rw-rw-r--. 1 1000 1000 2303 Jun 1 2016 README ===drwxr-xr-x. 6 501 games 4096 Oct 21 2014 serf ===drwxr-xr-x. 2 root root 71 Dec 20 2012 sqlite-amalgamation drwxrwxr-x. 36 1000 1000 4096 Nov 21 21:57 subversion drwxrwxr-x. 14 1000 1000 4096 Nov 21 21:57 tools -rw-rw-r--. 1 1000 1000 41944 Dec 7 2015 win-tests.py ===drwxr-xr-x. 14 501 games 4096 Apr 29 2013 zlib
下载serf构建工具
[root@min-base subversion-1.9.5]# cd serf [root@min-base serf]# wget http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz [root@min-base serf]# tar zxvf scons-local-2.3.0.tar.gz
按照如下顺序安装
安装apr
[root@min-base ~]# cd ~/subversion-1.9.5/apr [root@min-base apr]# ./buildconf [root@min-base apr]# ./configure [root@min-base apr]# make [root@min-base apr]# make install
安装apr-util
[root@min-base ~]# cd ~/subversion-1.9.5/apr-util [root@min-base apr-util]# ./buildconf [root@min-base apr-util]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config [root@min-base apr-util]# make [root@min-base apr-util]# make install
安装serf
[root@min-base ~]# cd ~/subversion-1.9.5/serf [root@min-base serf]# ln -s /root/subversion-1.9.5/serf/scons.py /usr/local/bin/scons [root@min-base serf]# scons APR=/usr/local/apr/bin/apr-1-config APU=/usr/local/apr/bin/apu-1-config OPENSSL=/usr PREFIX=/usr/local [root@min-base serf]# scons install
安装svn-client
[root@min-base ~]# cd ~/subversion-1.9.5/ [root@min-base ~]# ./configure --with-serf=/usr/local --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config [root@min-base ~]# make [root@min-base ~]# make install
使用
[root@min-base serf]# svn --version svn, version 1.9.5 (r1770682) compiled Jan 4 2017, 07:40:17 on x86_64-unknown-linux-gnu Copyright (C) 2016 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.8 (compiled with 1.3.8) - handles 'http' scheme - handles 'https' scheme The following authentication credential caches are available: * Plaintext cache in /root/.subversion * GPG-Agent