How to install GIT on Linux (Ubuntu & CentOS)
2018-01-27 00:00
495 查看
Installation on CentOS 7
We can install git using 2 methods i.e. either using yum or installing from source. We will start by using yum for git installation,YUM method
Just like any other software, we can install git using the ‘yum install’ command,$ yum install git
Git package is available with default Centos repositories. Once the git has been installed, we can check the installed version by executing,
$ git –version
Using Source package method
At the time of writing this tutorial, git 2.13.3 is the latest package available. So to download the latest git package, run$ wget https://github.com/git/git/archive/v2.13.3.zip
Now unzip the downloaded git.zip using the following command,
$ unzip v2.13.3.zip
$ cd git-2.13.3
Now before we move onto compiling & installing git, we need to make sure that we have all the required packages ,
$ yum install gcc perl-ExtUtils-MakeMaker
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
Once the packages have been installed, proceed further to compiling the git source code,
$ make configure
$ ./configure –prefix=/usr/local
$ make –prefix=/usr/local install
Once the setup has been completed, we can check the git version using the same command as above i.e.
$ git –version
Installation on Ubuntu 16.04
Similarly like CentOS , we can use 2 different methods to install git on Ubuntu. First method is using ‘apt-get’ & second is installing from source,Apt-Get method
To install git using ‘apt-get’, run the following commands,$ sudo apt-get update
$ sudo apt-get install git
Check the installed git version using command ,
$ git –version
Source package method
As done with CentOS installation, we will install the required packages for compiling source code first,$ sudo apt-get update
$ sudo apt-get install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
next, download the git source file,
$ wget https://github.com/git/git/archive/v2.13.3.zip
Now unzip the downloaded git.zip using the following command,
$ unzip v2.13.3.zip
$ cd git-2.13.3
Next, compile & install the source code
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
Once the setup is done, git will be installed.
In our future tutorials, we will discuss git in a little more depth. If having any questions/queries regarding this tutorial, please leave them in the comment box below.
If you think we have helped you or just want to support us, please consider these :-
Connect to us: Facebook | Twitter | Google Plus
7fe0
Become a Supporter – Make a contribution via PayPal
[paypal_donation_button align=”left” border=”1″]
Linux TechLab is thankful for your continued support.
相关文章推荐
- How to install Firefox 17 on Linux Mint, Ubuntu, Debian, CentOS, Fedora ... or any other Linux dist
- How to install GSL on linux(ubuntu,centos,redhat)
- How to Install Adobe Air 2 on Ubuntu 10.04 Linux Distro
- How To Install Git on Ubuntu 14.04
- How to install gcc-arm-linux-gnueabihf on Ubuntu 12.04
- How to Install Git on Ubuntu 12.04
- 如何在centos6.4上安装git How To Install Git on a CentOS 6.4 VPS
- How to Install WineHQ 1.5.27 on Fedora, CentOS and RHEL Linux Distributions
- How to Install Oracle Java JDK on Ubuntu Linux
- [转载]How to Install Firefox 33 on CentOS, Redhat and Other Linux Distributions
- How to Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6
- How to Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6 【Reliable】
- How to Install HTTP Git Server With Nginx on Ubuntu 16.04
- How To Install Speedtest-cli On a CentOS / RHEL / Scientific / Fedora Linux To Check Internet Speed
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on CentOS 6
- How to Install Python 3.5.2 on Ubuntu & Linuxmint
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04
- How to install Jboss + DB2 on CentOS Linux 4.5 ?
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04
- How To Install Git on CentOS 7