1. 程式人生 > 其它 >CentOS 7 安裝Git

CentOS 7 安裝Git

技術標籤:CentOSgitcentosgit

CentOS 7 安裝Git

1.安裝git
a、yum命令安裝

[[email protected] 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、原始碼安裝
安裝前要手動安裝下依賴包

[[email protected] local]# rpm -qa | grep wget
[[email protected] local]# yum install -y wget
[[email protected] local]# yum install -y gcc-c++
[[email protected] local]# yum install -y zlib-devel perl-ExtUtils-MakeMaker

獲取Git官網安裝包

[[email protected] software]
# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz [[email protected] software]# tar -zxvf git-2.9.0.tar.gz [[email protected] git-2.9.0]# cd git-2.9.0 [[email protected] git-2.9.0]# ./configure --prefix=/usr/local [[email protected] git-2.9.0]# make & make install

注意:./configure後面的–prefix=/usr/local,指定安裝路徑為usr/local

2.檢視git版本

[[email protected] xiongyingli]# git --version
git version 2.9.0