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 context, we shall look into how to Install and host the community edition of GitLab in Ubuntu 20.04.
What to do before Installing GitLab on Ubuntu Linux System ?
Before performing this Installation procedure, ensure that you a using a user with sudo rights.
Also, make sure you update the system package information by running the command:
$ sudo apt update
Then install the following necessary packages:
$ sudo apt install -y ca-certificates curl openssh-server
How to 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
With 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
How to Install 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 our case, we 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 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.
- Now, you can access the GitLab dashboard using the root user and password (recently changed).
- Then, you will see the dashboard.