背景
原來想在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