到 Git官网发现,git版本已经是 Git2.10.1
了,绝对安装最新的版本,所以我们必须采用编译安装,测试环境本地 Centos6.7,小编已经完成测试成功,在make安装时出现了错误提示,已经完美解决!
1、安装依赖包之前可以先检查下是否已经安装
# rpm -qa | grep zlib-devel
2、安装依赖包
在安装Git之前,需要先安装一些依赖包如果没有安装,我们先要安装这些依赖包:
# yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel # yum install curl-devel # yum install autoconf
3、下载新版的git2.9.3
建立文件夹 git,进入git文件夹。
到官网地址:https://github.com/git/git/releases
,选择 git-2.10.1.tar.gz
,下载git即可
[root@localhost ~]# mkdir git [root@localhost ~]# cd git [root@localhost git]# wget https://github.com/git/git/archive/v2.10.1.tar.gz
4.解压,编译安装(root用户下)
[root@localhost git]# chmod a+x v2.10.1.tar.gz [root@localhost git]# tar xzvf v2.10.1.tar.gz [root@localhost git]# cd git-2.10.1 [root@localhost git-2.10.1]# autoconf [root@localhost git-2.10.1]# ./configure --with-curl=/opt/git [root@localhost git-2.10.1]# make [root@localhost git-2.10.1]# make install
5、编译报错处理
make编译安装时报错,出现以下类似错误
SUBDIR perl /usr/bin/perl Makefile.PL PREFIX='/usr/local' INSTALL_BASE='' --localedir='/usr/local/share/locale' 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 package
重新执行:
[root@localhost git-2.10.1]# make [root@localhost git-2.10.1]# make install
没有报错!
6.验证
[root@localhost ~]# git --version git version 2.10.1