CentOS 6.x 安装最新版本 git

前端之家收集整理的这篇文章主要介绍了CentOS 6.x 安装最新版本 git前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
#!/usr/bin/env bash
# Install the latest version of git on CentOS 6.x
# Install required Packages
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install  gcc perl-ExtUtils-MakeMaker
# Uninstall old Git RPM
sudo yum remove git
# Download and Compile Git Source
cd /usr/src
sudo wget https://www.kernel.org/pub/software/scm/git/git-2.4.4.tar.gz
sudo tar xzf git-2.4.4.tar.gz 
cd git-2.4.4
sudo make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
sudo ln -s /usr/local/git/bin/git /usr/bin/git
source /etc/bashrc
# Check Git Version
git --version
  • 最好用/etc/profile 代替/etc/nashrc(/etc/profile是对所有 shell 生效的,而/etc/bashrc只对 bash 生效),如果你是用的是 zsh 而不是 bash,也可以把/etc/bashrc改成/etc/zshrc
  • 最新版本的 git 可以在 GitHub 上的 git 仓库页面找到,替换 wget 的网址即可
原文链接:https://www.f2er.com/centos/376772.html

猜你在找的CentOS相关文章