GitLab is an open source app that mostly is used in order to host Git repositories. It also give your additional features such as issue tracking. It is developed to use your own infrastructure, it’s flexible to deploy as an internal repository store for your dev team. The Gitlab project makes the procedure of installing Gitlab pretty much straight forward. Here you will see how can you install it in an Ubuntu 16.04 server, step by step.
How to install Gitlab on Ubuntu 16.04, a step-by-step guide:
First things first, you’re going to need the following:
1)Ubuntu 16.04 server
2)At least 2 cores of CPU
3) At least 2GB of Ram
How to install the Dependencies
Since Ubuntu’s default package provides us with all the software we require from its depositories we’re ready to install dependencies:
$sudo apt-get update $sudo apt-get install ca-certificates curl openssh-server postfix
For the “postfix” installation, select “Internet Site”.
How to install GitLab
Since you successfuly installed the dependencies, now you can install GitLab. First move into the /tmp directory, and download the following:
$cd /tmp $curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
Here you can find a hosted version of the script
Then, run the installer
$sudo bash /tmp/script.deb.sh
After the installation is complete, then the actual GitLab application is ready to be installed with “apt:”
$sudo apt-get install gitlab-ce
You can’t use the application yet, because yo need to run also an initial configuration command:
$sudo gitlab-ctl reconfigure
How to adjust the Firewall rules
This is needed to be done before you access GitLab for first time.
See current status of your firewall:
$sudo ufw status
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
So here, you can see that SSH traffic is allowed but there are some restrictions to other services. You need to allow HTTP access in because GitLab happens to be a web application. The protocol to port mapping for HTTP can be found in the /etc/services file. If you have not enabled OpenSSH traffic already then your should do that by typing:
$sudo ufw allow http $sudo ufw allow OpenSSH
Check ufw status command once more to see if access is given to at least these 2 services:
$sudo ufw status
Output Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 80 ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6)
If everything is done correctly now you can access GitLabs web interface.