Setup Gitlab Server



GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more. You can Self-host GitLab on your own servers, in a container, or on a cloud provider if you care about privacy and some customization can be done in this self-hosted or self-managed gitlab.


1. Install and configure the necessary dependencies

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

Next, install Postfix to send notification emails.

sudo apt-get install -y postfix

During Postfix installation a configuration screen may appear. Select 'Internet Site' and press enter. Use your server's external DNS for 'mail name' and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package


curl | sudo bash
sudo apt-get install gitlab-ee


curl | sudo bash
sudo apt-get install gitlab-ce

3. Configuring GitLab There is only one file to edit for configuration. open and edit /etc/gitlab/gitlab.rb . Within that file, you’re looking for the following line:

external_url ''

Modify that to reflect either your server domain or IP address. If you’re using an IP address, make sure to drop the https in favor of http.

Save and close that file. Reconfigure GitLab with the command:

sudo gitlab-ctl reconfigure

4. Browse to the hostname and login Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in

cat /etc/gitlab/initial_root_password

Use this password with username root to login.

5. Configure /etc/hosts (if you don't have a public dns)


6. Use your browser and Try access to your server ip


That's the tutorial for setting up gitlab self-host. If you are confused about the difference between gitlab self-host and gitlab SaaS ( and are confused about which one to use, you can search for it on the internet, many articles from gitlab itself discuss it.