[LINUX] [Addition] Vulnerability in git! I have to update! But yum doesn't have the latest version, and I got it from the source! Note when

You can also read it as git installation linux edition.

The current state (2020/04/20) Amazon Linux Git latest Ver. Git-2.14.6-1.62.amzn1. ~~ (It looks like no good ~~

Postscript (2020/05/05)

** As pointed out by @ SSW-SCIENTIFIC, a security patch has been applied to git-2.14.6-1.62 of linuxyum above **, and in terms of this vulnerability, Git compilation Insco updates ** not required **. Think of this article as a notebook on a board outside the exam range when you were a student. We apologize for the delay in updating the postscript due to fever. (Fortunately it wasn't Corona)

** Addendum: ** As of today (April 21, 2020) _, the latest Git has changed from 2.26.1 → 2.26.2, so I modified the command. ** After that, please check the latest version and rewrite the numbers **

Digression (other than Linux)

--For Windows, please use from here git.exe

git update-git-for-windows  #One shot

--Isn't it okay to use Homebrew on Mac (appropriate)?

brew update && brew upgrade git

--By the way (if you have it), you also need to update Xcode.

I want to install Git on Linux! (For AWS Amazon Linux 2)

First, check the status of Git

$ git --version
  git version 2.14.5

Yes. Let's upload the latest (2.26.2) and below obediently. (Although there is no need to distribute patches for low Ver ...)

yum update #You don't have to
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel  perl-ExtUtils-MakeMaker
#Insco git dependencies, otherwise I would cry later(Past completed)

git --version #It seems that old Git can be inserted at the time of inscoring the dependency
  git version 2.14.5 # `yum remove git`You can delete it, but ignore it.

wget https://www.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz
#here(https://mirrors.edge.kernel.org/pub/software/scm/git/)Find the latest from and drop

tar -zxf git-2.26.2.tar.gz #Deploy a lot
cd git-2.26.2 #The usual

make configure
./configure --prefix=/usr #Compile Compile
sudo make all
sudo make install # (_´Д`)No~~Otsukare

$ git --version
  git version 2.26.2

Clogged place

$ sudo make all
    SUBDIR git-gui #← This
    MSGFMT po/pt_pt.msg make[1]: *** [po/pt_pt.msg] Error 127
make: *** [all] Error 2
$ sudo make install
    SUBDIR git-gui
    MSGFMT po/pt_pt.msg make[1]: *** [po/pt_pt.msg] Error 127 #← This

__ If you do not enter the dependency relationship __ first, such an error will occur frequently. amen

Easy Update with Git installed

--If you don't do the second dependency, you'll end up getting stuck, so unfortunately those who installed from packages such as yum are erratic

#Clone the latest repository with the git command
git clone git://git.kernel.org/pub/scm/git/git.git

#Pull to get the latest source and compile again
cd git
git pull
sudo make all && sudo make prefix=/usr/local install #As you can see, the command abbreviation

#final confirmation
git --version

Postscript For Ubuntu

** Added an easy way by professor @ github0013 @ github! (Thanks!) ** Please check the comments for more details.

sudo add-apt-repository ppa:git-core/ppa
# >PPA is launchpad.A personal repository on the net(← Quote description).. Because it's an individual! Be careful when using it in other cases.
sudo apt update
sudo apt install git #The latest version is always available on ppa by git official, so you can get the latest version with this.

git --version
  git version 2.26.2

--Personal memo;

Debris (for old Ubuntu)

The following is ** no longer needed for Ubuntu Git **, but I will leave it for studying such as source → compile

#Moderately updated
sudo apt update
apt list --upgradable
sudo apt upgrade

sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
#Dependent commuter pass
sudo apt autoremove #← In the case of apt, a magic command that cleans tools that are no longer needed

#Daun Road, with yum from here
wget https://www.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz

tar -zxf git-2.26.2.tar.gz
cd git-2.26.2

make configure
./configure --prefix=/usr
sudo make all
sudo make install

Miscellaneous notes

Even though my Win terminal ended without any trouble, I searched for a site to death with the Update of ʻUbuntu and ʻAWS, and it took me about a stupid time ... You can see how you usually rely on rpm and yum package management (´ ・ ω:;.: ...)

I've actually written it so far, but I don't usually use it, so I think I'll forget it next week. And it seems foolish to wander around the sea on the net again and eat time, so I made it for myself!

After that, I think I'll dig into Evernote and copy and paste again every time I update or build a new one.

** If there is a mistake in the meaning of the comment comment, please let me know! ** **

Recommended Posts

[Addition] Vulnerability in git! I have to update! But yum doesn't have the latest version, and I got it from the source! Note when
I referred to it when I got stuck in the django geodjango tutorial (editing)
I got an error when I tried to process luigi in parallel on windows, but the solution
I got the date from the pub rice in Kagawa and drew a graph
Note that I understand the least squares algorithm. And I wrote it in Python.
What I did when I was angry to put it in with the enable-shared option
I raised the Python version from 2 to 3, but every time I restart the ubuntu terminal, the version remains 2.