How to install git online in CentOS

Time:2021-7-22

Before installing git, you need to install some dependent packages. Before installing the dependent packages, you can check whether they have been installed.

The shell command is as follows:

Copy code

The code is as follows:

# rpm -qa | grep zlib-devel

If not, we need to install these dependent packages first:

Copy code

The code is as follows:

# yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel
# yum install curl-devel
# yum install autoconf
# wget <a href=”http://git-core.googlecode.com/files/git-1.8.3.2.tar.gz”>http://git-core.googlecode.com/files/git-1.8.3.2.tar.gz</a>
# chmod +x git-1.8.3.2.tar.gz
# tar xzvf git-1.8.3.2.tar.gz
# cd git-1.8.3.2
# autoconf
# ./configure –with-curl=/opt/git
# make
# make install

Now git has been successfully installed. Let’s verify:

Copy code

The code is as follows:

# git –version
[[email protected] git-1.8.3.2]# git version
git version 1.8.3.2