git linux apt get,How to install GIT on Linux (Ubuntu & CentOS)

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 :-

[paypal_donation_button align=”left” border=”1″]

Linux TechLab is thankful for your continued support.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值