Install and configure GitLab CE on On-premises Server

Install and configure GitLab CE on On-premises Server

GitLab is a web-based DevOps lifecycle tool that provides a Git repository manager providing issue-tracking and continuous integration and deployment pipeline features, using an open-source license, developed by GitLab Inc. GitLab CE (Community Edition) - self-hosted, free and support from the Community forum.

Here we are going to install GitLab server on our on-premises server.


  • Ubuntu 18.04 Server
  • Min RAM memory 4GB - for better performance, use 8GB
  • Root privileges

What we are going to do Upgrade our os Install and configure openssh ,ca certificates,postfix,gitlab,letsencrypt reset root password for gitlab

Update and upgrade os

    sudo apt update
    sudo apt upgrade -y

Install openssh and postfix services

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

During this screen its asks post fix configuration give internet site and mail domain name in the next screen.

Download GitLab packages

    curl -sS | sudo bash

Install the packages you download

     sudo apt install gitlab-ce -y

After the installation change the URL and give the domain name you going to be used

     sudo vim /etc/gitlab/gitlab.rb

in this file change the external URL line

external_url ''

that same file change the lets encrypt section enable lets encrypt as true and give the lets encrypt contact mail address

letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['']

install lets encrypt using this command

    sudo apt install letsencrypt -y

after that reconfigure the gitlab using the below command

    sudo gitlab-ctl reconfigure

After all this u got the GitLab home screen as your configured domain name


if you want to reset user name and password means execute the below command

its asking username and password

    sudo gitlab-rake "gitlab:password:reset"

Final steps

Now we are going to allow the required ports in firewall and enables it.

Using this commands you can allow the required** protocols

    sudo ufw allow ssh
    sudo ufw allow http
    sudo ufw allow https

Enable the firewall on system startup

    sudo ufw enable

Did you find this article valuable?

Support Venketraman by becoming a sponsor. Any amount is appreciated!