GitLab is a complete DevOps platform tool that provides features like managed git repositories, integrated CI/CD pipelines for the applications, Kubernetes integration, and many more which helps in software development. It is a web-based hosting tool that helps in the remote distribution of source code among the team. GitLab has two versions: an enterprise edition that provides paid features and a community edition that is open source and free.
In this article, we will be installing and hosting the community edition of GitLab in Ubuntu 20.04.
Installing Prerequisite Dependencies
Before installing the packages make sure you update the package information.
$ sudo apt update
Then install the following necessary packages
$ sudo apt install -y ca-certificates curl openssh-server
Append GitLab Package Repository in the System
Once all the dependencies installed you need to run the following curl command to download the bash script which adds package info to your system which helps the apt to manage GitLab deb packages for you.
$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
In the above curl command, the -s option refers to silent (i.e no progress bar), and the -S option refers to show an error.
Now, you can see the GitLab package repository content in the following path:
$ cat /etc/apt/sources.list.d/gitlab_gitlab-ce.list
Installing GitLab CE Package
You have just added a gitlab repository so once again update your system.
To install the GitLab CE package execute the following command.
$ sudo apt update
$ sudo apt install gitlab-ce -y
After installation is complete, we need to replace the existing example subdomain with a valid domain or sub-domain in the external_url section. In my case, I will go with my device IP for the demonstration. If you want to use a local domain name, you can configure at /etc/hosts.
$ sudo vim /etc/gitlab/gitlab.rb
Now, once configured execute the following command to apply the configuration changes. It might take a while to complete the re-configuration.
$ sudo gitlab-ctl reconfigure
After reconfiguration finished, you can check the status by running:
$ sudo gitlab-ctl status
You can execute the following command to start the service,
$ sudo gitlab-ctl start
Then, to stop the service run,
$ sudo gitlab-ctl stop
Browsing GitLab Web Interface
Now, after everything has been setup you can access GitLab in your local device or server through configure domain name. In my case, it’s my system ip then you will see the following result output in the browser.
In the initial phase, you will be requested to change the password of the root user. Once the password is changed you will be redirected to the login page which looks like this.
Now, you can access the GitLab dashboard using the root user and password (recently changed). Then, you will see the dashboard like below.
In this article, we learn how to integrate the GitLab CE into our local Ubuntu system. I hope this article will help you to install GitLab on your local devices or server.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.