Centos6 升级Git版本

xiaoxiao2021-02-28  88

Centos 6 升级Git版本

Centos 6自带Git版本1.7.1,无法满足项目需求,故升级至最新Git版本。

1、删除现有版本Git

yum remove git

2、安装编译git时所需要的包

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

3、下载最新版本Git(2.9.5)

下载地址:https://www.kernel.org/pub/software/scm/git/

wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz tar -zxvf git-2.9.5.tar.gz

4、编译安装

cd git-2.9.5 make prefix=/usr/local/git all make prefix=/usr/local/git install echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc source /etc/bashrc

5、检查Git安装版本

git --version

在这里如果报错:git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

解决办法: 在/etc/ld.so.conf中加一行/usr/local/lib 然后运行/sbin/ldconfig 就解决了~

转载请注明原文地址: https://www.6miu.com/read-78037.html

最新回复(0)