CentOS 7 安装Git
1.安装git
a、yum命令安装
[root@cnetos7 local]# yum install -y git
Installed:
git.x86_64 0:1.8.3.1-23.el7_8
Dependency Installed:
perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-23.el7_8 perl-TermReadKey.x86_64 0:2.30-20.el7
Complete!
b、源码安装
安装前要手动安装下依赖包
[root@cnetos7 local]# rpm -qa | grep wget
[root@cnetos7 local]# yum install -y wget
[root@cnetos7 local]# yum install -y gcc-c++
[root@cnetos7 local]# yum install -y zlib-devel perl-ExtUtils-MakeMaker
获取Git官网安装包
[root@cnetos7 software]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz
[root@cnetos7 software]# tar -zxvf git-2.9.0.tar.gz
[root@cnetos7 git-2.9.0]# cd git-2.9.0
[root@cnetos7 git-2.9.0]# ./configure --prefix=/usr/local
[root@cnetos7 git-2.9.0]# make & make install
注意:./configure后面的–prefix=/usr/local,指定安装路径为usr/local
2.查看git版本
[root@cnetos7 xiongyingli]# git --version
git version 2.9.0