How to install own Gitlab server on Ubuntu 20.04 & 18.04

This article let you know to configure your own Gitlab server easy way


GitLab is a fully-featured platform to accelerated your software development process. It is  providing features like, Kubernetes integration, DevOps integrated CI-CD, GitLab Container Registry etc.

Lets start Gitlab installation step by step,

Step.1 Install required dependencies

Use below commands,

$sudo apt update
$sudo apt upgrade -y

Now, install Gitlab required dependency

$sudo apt install -y ca-certificates curl openssh-server

Step.2 Install & configure Postfix SMTP

You we have to install and configure Postfix SMTP only server to send you activities of Git server. You can easily do it by vising our article Install and configure postfix-smtp-only-server easy way  

Step.3 Add GitLab repository

After all prerequisites installation completed, you have to add Gitlab repository with below commands,

curl -sS | sudo bash

You could see below results,


Now, the repository contents are added to,

$ cat /etc/apt/sources.list.d/gitlab_gitlab-ce.list 
# this file was generated by for
# the repository at

deb bionic main
deb-src bionic main

Step.4 Install GitLab

Now, install GitLab using below command,

sudo apt update
sudo apt -y install gitlab-ce

In case of you faced error message “E: Unable to locate package gitlab-ce“ on Ubuntu 20.04, then you can use repository for Ubuntu 18.04

sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ce.list<<EOF 
deb bionic main
deb-src bionic main

sudo apt update
sudo apt install gitlab-ce

You will see the below results


Now, you can edit GitLab configuration file to set settings according to your requirements. Use below command,

$ sudo vim /etc/gitlab/gitlab.rb

Now, start GitLab, use below command,

sudo gitlab-ctl reconfigure

As soon as you hit above command, all GitLab services will  start, as you can see in below image,


Step.5 Access GitLab

After all installation of GitLab now, its testing time, Open web browser and enter URL,      It will finish installation.

On the first log in screen you will be prompt to change root password. So, change root password.

Then you can login with root user and its new password, you can see GitLab login as below,


Step.6 GitLab Administration

You can use below various command to administrate GitLab server.

Use below command, If you done any changes in /etc/gitlab/gitlab.rb

$sudo gitlab-ctl reconfigure
$sudo gitlab-rake gitlab:check

To check GitLab service status, use below command,

$sudo gitlab-ctl status

Use command to stop GitLab service,

$sudo gitlab-ctl stop

To restart GitLab service,

$sudo gitlab-ctl restart

Last but not the least,  you can also restart any service by providing service name at the end.



This way, you learnt to configure your own Gitlab server with easy way on Ubuntu 18.04 & 20.04

Hope this article helpful for you, please like, share and subscribe to



Related Article

5 Easy steps to know continuous integration and continuous deployment

Thanks for visiting to


Suresh Dike

Suresh Dike I am Suresh, working on Cloud, DevOps, Linux, Firewalls,Docker and Kubernetes. Believes in sharing the knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.