Introduction


Git is a distributed revision control and source code management system with emphasis on speed. It was originally design and developed by Linus Torvalds for Linux kernel development in 2005.

 

Every Git working directory is a full fledged repository with complete history and full version tracking capabilities not dependent on network access or a central server. Therefore, it constitutes a great tool for working with projects of any size.

 

It is free software distributed under the terms of the GNU General Public License version 2.

 

In this guide we will cover how to install Git on a CentOS 6.x server using yum. We will also show you how to instal git from source and with its latest version on CentOS 6.x server.

 

How to Install Git Using Yum


CentOS 6.x can be installed from its default repositories, as follows:

sudo yum -y install git

 

Remember, the -y option implies yum will answer yes to all installation questions.

That's it, you now have Git installed on your CentOS 6.x VPS.

 

How to Install Git from Source on CentOS 6.x


Most of the time, you will want to work with the most recent version of Git. Generally, CentOS repositories will not provide update versions in order to maintain well tested versions on the default's repositories.

In order to get the latest version, you will need to install it from source

To verify your currently installed version of Git, you can enter the following command:

git --version

 

You will have an output like this:

git version 1.7.1

 

As of this writing, the latest Git version is 1.8.4. To install this version, you need to download compilation tools for CentOS, like this:

sudo yum -y groupinstall "Development Tools"

 

With this, you will be able to convert source code into binary executables.

 

Now, install extra dependencies needed for Git to run:

sudo yum -y install gcc perl-ExtUtils-MakeMaker openssl-devel asciidoc xmlto zlib-devel 

 

Move to your user's directory:

cd ~

 

Now, download the latest master archive with the lates version of Git from Github.com :

wget -O git.zip https://github.com/git/git/archive/master.zip

 

You will need to unzip the downloaded file:

unzip git.zip

 

Change your working directory to the new unzipped one:

cd git-master

 

Now, configure, make and install:

make configure
./configure --prefix=/usr/local
make all doc
sudo make install install-doc install-html

 

That's it, you have successfully installed the latest version of Git from source on a CentOS VPS.

 

Test on a Miami VPS Now

or

Deploy on a Miami Dedicated Server

Was this answer helpful? 6 Users Found This Useful (10 Votes)