What is GitLab?
GitLab is an open-source platform designed primarily for hosting Git repositories. It offers a wide variety of features, including project management tools, continuous integration, and tracking issues. It is a cloud-based Git repository and DevOps platform that offers developers an integrated environment for testing, monitoring, and deploying their code. It offers a wide range of tools and features for managing Git repositories, continuous integration/continuous deployment (CI/CD), code review, issue tracking, collaboration, etc.
What is the difference between Gitlab and GitHub?
We already discussed what Gitlab is; now, we can look into the differences between Gitlab and GitHub.
GitHub is an open-source version control system used to manage and track file modifications. GitHub can be used with any file type. However, it is most commonly used to track code files.
While GitLab and GitHub are among the most popular web-based Git repository hosting services, developers compare them due to their distinct techniques for code repository management and hosting.
* GitHub gives a free private repository for up to three collaborators, while GitLab offers a free private repository with no limits.
* Comparing GitLab and GitHub, GitLab is a tool for managing repositories and the software development process, while GitHub is a service for hosting repositories with features for access control and collaboration.
* The major difference between GitHub and GitLab is that GitHub lets you choose your CI/CD tools after integration, while GitLab comes with built-in CI/CD tools and DevOps workflows.
* Gitlab is more secure than GitHub.
Now let’s look at how to configure Gitlab on Ubuntu,
Configure GitLab on Ubuntu
Step 1 - Installing Dependencies
sudo apt update
sudo apt install ca-certificates curl openssh-server postfix tzdata perl
Step 2 - Installing Gitlab
cd /tmp
curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
Select Internet Site as the mail configuration type and press Ok. After a screen will appear press Ok to save the defaults.
less /tmp/script.deb.sh
sudo bash /tmp/script.deb.sh
sudo apt install gitlab-ce
Step 3 - Adjusting the Firewall Rules
Before configuring GitLab, make sure the rules of the firewall are permissible to permit web traffic.
sudo ufw status
sudo ufw allow http
sudo ufw allow https
sudo ufw allow OpenSSH
Step 4 - Configuring the Gitlab
sudo nano /etc/gitlab/gitlab.rb
Locate the external_url and replace it with your domain and also ensure http is changed to https for automatic redirection to the site secured by the Let’s Encrypt certificate.
...
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'https://your_domain'
...
sudo gitlab-ctl reconfigure
Step 5 - Initial Configuration through the Web Interface
Log in to the server using your domain name
https://your_domain
GitLab generates an initial secure password for you, which is stored within a directory accessible to administrative sudo users.
sudo nano /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the firs$
# 2.The password has not been manually changed, either through the user interface or the command line.
#
# You should reset the admin password if the password displayed here does not work
https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: YOUR_PASSWORD
# NOTE: This file will be deleted automatically during the first reconfigure run after 24 hours.
Enter the username as root and password listed on /etc/gitlab/initial_root_password in the login page and Sign in. Now you are all set to use GitLab.