环境
系统:CentOS 7
虚拟机:VMware
之前安装git是通过源安装的,版本低的可怕,才1.8。决定下载源码自己编译一个。记录一下过程。
#yum install git
git --version
#git version 1.8.3.1
首先下载源码,下载地址https://github.com/git/git/releases ,下载到你喜欢的地方。我习惯放/home下。
#cd /home
#wget https://codeload.github.com/git/git/tar.gz/v2.19.0-rc1
下载下来以后解压。
#tar -xvf git-2.19.0-rc1.tar.gz
进目录装备编译,配置下先
#cd git-2.19.0-rc1
#./configure
-bash: ./configure: No such file or directory
结果找不到目录。。。。
找了下资料,官方文档https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
需要使用make configure命令
#make configure
GIT_VERSION = 2.19.0-rc1
GEN configure
/bin/sh: autoconf: command not found
缺少autoconf,安装一个
#yum install autoconf
再次运行make configure可以了。开始配置。
#./configure --prefix=/usr
可以开始编译了。
#make all
* new build flags
CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:20:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^
compilation terminated.
make: *** [credential-store.o] Error 1
发现缺少点工具,通过yum安装。
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
在次make all开始编译。
# git --version
git version 1.8.3.1
编译完成。
参考资料:
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git