Hello, friends. In this post, you’ll learn how to install Gitlab CE in Ubuntu 20.04. This way you’ll be able to deploy a repository hosting platform that you can manage yourself.
If we think of a website to host our git repositories, the first thing that comes to mind is Github but the truth is that every day more and more projects have been created with Gitlab.
Gitlab is an application designed for the management of the software that is created. This management includes a follow up of the code thanks to Git but also DevOps tools.
Without a doubt, to give an idea of what GitLab is, the fastest way would be to compare it with one of its competitors, GitHub, as the latter is especially well known in the world of software development. However, little by little, it has managed to go even further, offering a wider range of services that will delight not only developers but also DevOps.
You can choose to use the service directly on the project’s website or you can download it to your servers and manage it yourself. Ideal for companies that want to have even more precise control of the software they develop.
Install Gitlab CE on Ubuntu 20.04
The installation is quite simple but requires some preconditions:
- A recent installation of Ubuntu 20.04
- A registered domain name
- You need a user who has permission to use sudo.
So let’s get started.
Open a terminal or connect to your server using SSH and update the system:
sudo apt update
sudo apt upgrade
And then install some necessary packages:
sudo apt install ca-certificates curl openssh-server postfix
Note: If you want to use another solution to send emails, you can skip the Postfix package.
If you have installed Postfix, during the installation you will be asked to configure it. Choose Internet Site in this step
And in the next one choose your domain name as indicated on the screen output.
Then you have to download the installation script. For this, you can use the wget command.
wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh --2021-01-09 22:18:35-- https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh Resolving packages.gitlab.com (packages.gitlab.com)… 2600:1f1c:2d4:8900:17a1:2e94:9f90:f91e, 54.153.54.194 Connecting to packages.gitlab.com (packages.gitlab.com)|2600:1f1c:2d4:8900:17a1:2e94:9f90:f91e|:443… connected. HTTP request sent, awaiting response… 200 OK Length: 5933 (5.8K) [text/install_instructions] Saving to: ‘script.deb.sh’ script.deb.sh 100%[=====================================================================================>] 5.79K --.-KB/s in 0s 2021-01-09 22:18:35 (2.06 GB/s) - ‘script.deb.sh’ saved [5933/5933]
Now you need to run it:
sudo bash script.deb.sh Detected operating system as Ubuntu/focal. Checking for curl… Detected curl… Checking for gpg… Detected gpg… Running apt-get update… done. Installing apt-transport-https… done. Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list…done. Importing packagecloud gpg key… done. Running apt-get update… done. The repository is setup! You can now install packages.
By adding the Gitlab repository, you can start the installation. To do this you have to add the domain you have. And to set it up as HTTPS the installer will automatically download and install a Let’s Encrypt certificate. For this example, I will use my test domain, remember to change it to yours.
sudo EXTERNAL_URL="https://angtest.ga" apt-get install gitlab-ce
Then it will start the whole installation process which can take a few minutes according to the power of your server. Please be patient.
At the end you will see the following output on the screen:
Now we can verify the installation.
Access to Gitlab on Ubuntu 20.04
Now go to the address you specified in the Gitlab installation and you will see the change password screen. Here you have to set the initial password for the root user.
Then you will see the login screen where you can log in with the root user and the previously defined password.
And then you’ll see the Gitlab Instance Management screen.
Enjoy it.
Conclusion
Gitlab is a very popular solution these days that GitHub has been bought by Microsoft. That’s why it’s good to know how to install it and be the one who manages all that collection of possibilities.