Are you familiar with Git and how to install git on ubuntu 18.04?
Git becomes one of the most popular version control systems. Here at Bobcares, we install Git as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at how to install it.
Why is Version control systems so important?
Version control is very important to keep track of changes. Git is a tool that acts as a version control system to distribute changes from the local machine to the repo and vice versa. Now, most of the projects’ files are maintained in a Git repository, and sites like GitHub, GitLab.
- Track changes
- Revert to previous stages.
- Branch to create alternate versions of files and directories.
Also, Git allows track changes in source code and helps to track changes in files.
How to install git on ubuntu 18.04
As a Prerequisites, the root privilege requires to install git on ubuntu 18.04
1. Installing Git with Default Packages
First, we use the apt package management tools to update the local package index. With the update complete, download and install Git:
apt update
apt install git
We ensure that if we installed Git correctly by running the following command:
git --version
Output looks like,
git version 2.17.1
2. Installing Git from Source
A more secure and safe method of installing Git is to compile the software from source. This takes a longer time than the other method. However, it allows to download the latest release and provide some control over the options to customize.
1. Initially, we need to install the software that Git depends on. This is all available in the default repositories, so we update the local package index and then install the packages.
apt update
apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
3. After that, we install the necessary dependencies, the version of Git is available by visiting the Git project’s mirror on GitHub, the URL:
https://github.com/git/git
4. Next, on the right side of the page, we click on the Clone or download button > right-click on Download ZIP and we copy the link address that ends in .zip.
5. Then, we move into the tmp directory to download temporary files.
cd /tmp
6. Again, we use the command utility wget to install the copied zip file link. We specify a new name for the file. gitfile.zip.
wget https://github.com/git/git/archive/v2.18.0.zip -O gitfile.zip
7. Unzip the file that downloaded and move this into the resulting directory by typing:
unzip gitfile.zip
cd git-*
Now, we make the package and install it by typing these two commands:
make prefix=/usr/local all
make prefix=/usr/local install
Finally, we ensure if the install successful by typing git –version
[Need any assistance to install Git? – We’ll help you]
Conclusion
In short, Git allows track changes in source code and helps to track changes in files. In today’s writeup, we saw how our Support Engineers install Git on Ubuntu 18.04.
0 Comments