centos7 git更新

                                                                                                 centos7 git 更新

centos7.3 通过yum  安装的Git  默认为1.8.3。存在Git 远程代码执行漏洞 (CVE-2016-2315)

Git小于2.7.1的全版本中存在一个由于整数溢出导致的缓冲区边界溢出的远程代码执行漏洞,可使攻击者远程执行任意代码。因此需要手工进行更新。

1、卸载自带的git。

yum  remove git (安装新版本之后卸载也可以)

2、安装所需的软件包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel   gcc perl-ExtUtils-MakeMaker


3、下载安装

# make prefix=/usr/local/git all

# make prefix=/usr/local/git install

编辑/etc/profile ,并添加
export PATH=/usr/local/git/bin:$PATH

#source /etc/bashrc

安装过程中编译安装报错信息:

    CC http-walker.o
    CC http-fetch.o
    LINK git-http-fetch
    CC http-push.o
http-push.c:18:19: fatal error: expat.h: No such file or directory
 #include
经查询需要安装

#yum install expat-devel

重新安装又报错:

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2

需要安装yum install perl-ExtUtils-MakeMaker

4、测试验证:

 git --version
git version 2.7.3



你可能感兴趣的:(centos7 git更新)