CentOS7编译安装Git

CentOS7编译安装Git

环境

系统硬件:CPU : 2 * 4核,内存 2G
系统版本:CentOS-7.2.1511 Core

安装步骤

1.显示服务器版本

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux```

2.安装git

2.1 下载git-2.11.0.tar.gz

[root@localhost ~]# cd /usr/local/src
[root@localhost ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.11.0.tar.gz

2.2 安装依赖的库

[root@localhost ~]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel

2.3 删除原本的安装的git

[root@localhost ~]# yum -y remove git

2.4 编译安装

[root@localhost ~]# cd /usr/local/src
[root@localhost ~]# tar -zvxf git-2.11.0.tar.gz
[root@localhost ~]# cd git-2.11.0
[root@localhost ~]# make prefix=/usr/local/git all
[root@localhost ~]# make prefix=/usr/local/git install

2.5 增加软连接

[root@localhost ~]# ln -s /usr/local/git/bin/* /usr/bin/
[root@localhost ~]# git --version
git version 2.11.0

如何能显示版本号,即表示成功


标题:CentOS7编译安装Git
作者:willow
地址:https://www.designcoding.com/centos-gitlab