1,安装git依赖包

Centos7.2安装git(源码安装)

,2,卸载自带的perl

ls /usr/bin/perl 

注:切记在git源码编译安装时需要用到perl.mak文件,因为默认Centos7系统自带perl版本太低或者/usr/bin/perl这个目录为空(du -sh命令查看),所以需要我们手动源码升级。

yum remove perl

Centos7.2安装git(源码安装)

3,安装perl依赖包

yum -y install cpan
注:这个包是用来编译安装perl的

Centos7.2安装git(源码安装)

 4,下载perl,解压到local下

下载地址:http://www.cpan.org/src/5.0/perl-5.16.1.tar.gz

Centos7.2安装git(源码安装)

 

5,编译并安装perl

cd /usr/local/perl-5.16.1

//配置安装目录 ./Configure -des -Dprefix=/usr/bin/perl

Centos7.2安装git(源码安装)

//编译 make

Centos7.2安装git(源码安装)

 

//编译测试 make test

Centos7.2安装git(源码安装)

 

//安装 make install 

Centos7.2安装git(源码安装)

 //查看perl版本 perl -v

Centos7.2安装git(源码安装)

 

6,卸载自带git

yum remove git

7,进入git在git解压目录下执行命令

 Centos7.2安装git(源码安装)

 

Centos7.2安装git(源码安装)

 

make configure

Centos7.2安装git(源码安装)

注:报错/bin/sh: autoconf: command not found,使用yum安装autoconf即可

Centos7.2安装git(源码安装)

//然后重新执行测试命令

make configure

Centos7.2安装git(源码安装)

8,指定git安装目录

./configure --prefix=/usr/local/git

Centos7.2安装git(源码安装)

9、编译git

make profix=/usr/local/git

Centos7.2安装git(源码安装)

10、安装git

make install

Centos7.2安装git(源码安装)

 

11、设置环境变量

vi /etc/profile

GIT_HOME=/usr/local/git
PATH=$PATH:$GIT_HOME/bin
export PATH GIT_HOME

 Centos7.2安装git(源码安装)

 

12、使环境变量生效

source /etc/profile

13、检查git版本

git --version

Centos7.2安装git(源码安装)

 

相关文章:

  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-08-12
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2021-08-10
  • 2022-01-16
  • 2022-01-04
  • 2021-10-24
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案