How To Install Git on Ubuntu 16.04

Install Git on Ubuntu 16.04

In this tutorial, we will show you how to install and configuration of Git on your Ubuntu 16.04 server. For those of you who didn’t know, Git, a powerful and widely used distributed version control system, has become an essential tool for developers and teams working on software projects. Its ability to efficiently manage source code, track changes, and facilitate collaboration has made it a go-to choice for many.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation Git on a Ubuntu 16.04 (Xenial Xerus) server.


  • A server running one of the following operating systems: Ubuntu 16.04 (Xenial Xerus).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Git on Ubuntu 16.04

Step 1. To ensure you have access to the latest package information, it’s crucial to update your local package index. Open a terminal and run the following command:

sudo apt-get update
sudo apt-get upgrade

This command will fetch the latest package lists from the Ubuntu repositories, allowing you to install the most recent version of Git available.

Step 2. Installing Git on Ubuntu 16.04.

  • Method 1: Install Git from Ubuntu Repositories

The simplest and most straightforward method to install Git on Ubuntu 16.04 is by using the default Ubuntu repositories. Follow these steps to get started:

sudo apt-get install git

Once the installation is complete, it’s a good practice to verify that Git is properly installed and accessible. Run the following command in the terminal:

git --version

Before you start using Git, it’s important to configure your user name and email address. This information will be associated with your commits, allowing others to identify your contributions. Use the following commands to set your user name and email:

git config --global "Your Name"
git config --global ""

Replace “Your Name” with your desired user name and “” with your email address.

  • Method 2: Install Git from Source

If you require a specific version of Git or want more control over the installation process, you can opt to install Git from the source code. Here’s how:

Before compiling Git from source, you need to install the necessary dependencies. Run the following command in the terminal:

sudo apt-get install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

Visit the official Git website and download the latest source code archive. You can either download the zip file or the tar.gz file, depending on your preference.

Once the download is complete, navigate to the directory where the source archive is located and extract its contents. If you downloaded the zip file, use the following command:

unzip git-<version>.zip

If you downloaded the tar.gz file, use the following command instead:

tar -zxf git-<version>.tar.gz

Change into the extracted source code directory using the cd command:

cd git-<version>

Now, compile Git by executing the following commands:

make prefix=/usr/local all
sudo make prefix=/usr/local install

After the compilation and installation process is complete, verify the Git installation by running:

git --version

Congratulations! You have successfully installed Git. Thanks for using this tutorial for installing Git in Ubuntu 16.04 (Xenial Xerus) systems. For additional help or useful information, we recommend you check the official Git website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!





r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button