Debian is a great operating system. Perhaps along with CentOS and RHEL the most stable of all Linux. Debian can do very important jobs like developing applications or being the operating system of a server. All this thanks to the fact that it is a very stable system where the software is constantly tested to obtain the best results. However, the software available in Debian is not always the most up to date and over time this can be a problem. So, with this in mind, I will teach you how to install the latest stable version of Git on Debian 9 Stretch or Ubuntu 19.04.
Install the latest version of Git from the source code
There is no reliable repository to install the latest version of Git on Debian 9 or Ubuntu 19.04. However, we can manually compile the source code. The process is not complicated and will help us to have current and fast Git.
First of all, you have to update the system.
:~$ su :~# apt update && apt upgrade
Note: In case Ubuntu doesn’t have root enabled, you just need to type sudo before the commands.
After that, you need to install some packages to install Git.
:~# apt install build-essential make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Then, it is necessary to know which is the latest stable version of Git. To do this, it is good to go to the program website. At the time of writing this article, it is 2.21.0 so the command to write is as follows.
:~# cd /tmp/ :~# wget wget https://github.com/git/git/archive/v2.21.0.zip -O latestgit.zip
Next, decompress it and move to the generated folder.
:~# unzip latestgit.zip :~# cd git-2.21.0
Now, you can build and install Git. To do it, just run these commands:
:~# make prefix=/usr/local all :~# make prefix=/usr/local install
Once the process is complete, you can verify which version is installed.
:~# git --version
With this, Git is now installed and ready to use.
Getting the latest version of Git in Debian 9 or Ubuntu 19.04 is not a complicated matter, however, it can be useful for the development of our applications. We have achieved this by manually compiling the application, this way it becomes simpler and safer.
Please share this post with your friends.