Centos6.7安装编译安装最新Git2.10.1

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即可

[[email protected] ~]# mkdir git
[[email protected] ~]# cd git
[[email protected] git]# wget https://github.com/git/git/archive/v2.10.1.tar.gz

4.解压,编译安装(root用户下)

[[email protected] git]# chmod a+x v2.10.1.tar.gz
[[email protected] git]# tar xzvf v2.10.1.tar.gz 
[[email protected] git]# cd git-2.10.1
[[email protected] git-2.10.1]# autoconf
[[email protected] git-2.10.1]# ./configure --with-curl=/opt/git
[[email protected] git-2.10.1]# make
[[email protected] 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

重新执行:

[[email protected] git-2.10.1]# make
[[email protected] git-2.10.1]# make install

没有报错!

6.验证

[[email protected] ~]# git  --version
git version 2.10.1

发布日期:

所属分类: Linux/Centos/Os 标签: