In this tutorial we’ll learn how to install Gitlab on Ubuntu 16.04. We will also install and configure its prerequisites. Gitlab is a popular git repository hosting application. You can use it to store versioned copies of code and collaborate with others. It provides a web interface that allows you to view syntax-highlighted code, compare diffs, handle merge requests, etc. It is comparable in many ways to Github, except that you can host Gitlab on your own server.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Gitlab on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y && apt-get upgrade -y
Step 2. Installing the necessary dependencies.
You’all need to install some basic prerequisite packages for Gitlab:
apt-get install curl openssh-server ca-certificates postfix
To start and enable to prerequisite packages OpenSSH and Postfix to run on boot, execute the following four commands:
systemctl start sshd systemctl start postfix
Step 3. Installing Gitlab.
Now execute the following command to add Gitlab package server into your repository:
curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
Once download is completed, run the downloaded installation script with the following command:
sudo bash script.deb.sh
After the installation is complete, then the actual GitLab application is ready to be installed with “apt”:
apt-get install gitlab-ce
Now you will need to run the following command to configure and run GitLab:
Step 6. Configure Firewall for GitLab.
Before accessing the GitLab, you will need to allow SSH and HTTP service through UFW firewall:
sudo ufw enable sudo ufw allow OpenSSH sudo ufw allow http
Step 7. Accessing Gitlab Web Installation.
Now you can access the Gitlab web install wizard in your browser by entering the domain name or http://your_ip/ to continue your installation.
Congratulation’s! You have successfully install and configured Gitlab on your Ubuntu 16.04 LTS server.