redhat6.3下源码编译方式安装最新版git

时间:2022-09-02 15:38:44

在linux下安装git,通过yum方式安装的不是最新版本。

要替换最新版需要以下操作。

1.安装依赖包

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

2.卸载旧的RPM

# yum remove git

3.下载编译git源码

可以在其他地址下载

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.0.4.tar.gz
# tar xzf git-2.0..tar.gz
# cd git-2.0.
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
#
# echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc
# or
# echo 'export PATH=$PATH:/usr/local/git/bin' > /etc/profile.d/git.sh
#
# source /etc/bashrc

4.查看git版本

# git --version
git version 2.0.