Centos7.2安装git

1,安装git依赖包

,2,卸载自带的perl

ls /usr/bin/perl 

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

yum remove perl

3,安装perl依赖包

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

 4,下载perl,解压到local下

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

5,编译并安装perl

cd /usr/local/perl-5.16.1

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

//编译 make

//编译测试 make test

//安装 make install 

 //查看perl版本 perl -v

6,卸载自带git

yum remove git

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

make configure

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

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

make configure

8,指定git安装目录

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

9、编译git

make profix=/usr/local/git

10、安装git

make install

11、设置环境变量

vi /etc/profile

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

 

12、使环境变量生效

source /etc/profile

13、检查git版本

git --version

猜你喜欢

转载自www.cnblogs.com/guigushanren/p/10163177.html