How to install Gitlab on our server with Ubuntu

Gitlab logo

A few weeks ago we knew the sudden purchase of GitHub by Microsoft. A controversial purchase that many defend as if they had made it or criticize it harshly as if it were the advent of the fall of Free Software. Personally, I do not believe or defend either of the two positions but it is true that such news has caused many software developers to abandon Github services and look for other alternatives as free as Github before their purchase by Microsoft.

There are many services that are becoming popular, but the vast majority of developers are choosing to use GitLab, a free alternative that we can install on our computer with Ubuntu or on a private server that uses Ubuntu as the operating system.

What is GitLab?

But first of all, let's see what it is exactly. Gitlab is a software version control that uses Git technology. But unlike other services, it incorporates other functions besides Git such as the wikis service and a bug tracking system. Everything is licensed under the GPL license, but it is true that like other types of software such as WordPress or Github itself, anyone cannot use Gitlab. Gitlab has a web service that offers two types of accounts to its clients: a free account with free and public repositories and another paid or premium account that allows us to create private and public repositories.

This means that all our data is hosted on servers external to us whose control we do not have, as with Github. But Gitlab has a version more called Gitlab CE o Community Edition that allows us to install and have a Gitlab environment on our server or computer with Ubuntu, although the most practical is to use it on a server with Ubuntu. This software offers us the benefits of Gitlab Premium but without having to pay anything for it, since we install all the software on our server and not on another server.

Gitlab, as with the Github service, offers interesting resources such as cloning repositories, developing static web pages with Jekyll software or a version control and code that will allow us to be informed if the software or the revision contains any errors or not.

The power of Gitlab is superior to Github, at least in terms of service, if we use it as our server's own software, the power will depend on the hardware of our server. Something that must be taken into account if what we are going to do is change the Github software for the Gitlab software on our private server.

What do we need to install GitLab on an Ubuntu server?

To have Gitlab or Gitlab CE on our server, first we have to install the dependencies or software that is needed for the software to work correctly. To do this we open a terminal and write the following:

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

Possibly a package like curl will already be on our computer but if it isn't, this is a good time to install.

GitLab installation

Gitlab CE external repository

Now that we have all the Gitlab dependencies, We have to install the Gitlab CE software, which is public and we can get it through a repository external to Ubuntu. To do this we open a terminal and write the following:

curl -sS | sudo bash

There is another method that involves using an external repository but with the Apt-get software tool. To do this, instead of writing the above in the terminal, we have to write the following:

sudo EXTERNAL_URL="" apt-get install gitlab-ce

And with this we will have the Gitlab CE software on our Ubuntu server. Now it's time to do some basic settings for it to work properly.

Gitlab CE configuration

The first thing we have to do is release certain ports that Gitlab uses and that they will be closed and we use a firewall. The ports that we have to open or that Gitlab uses are the port 80 and the 443.

Now, we have to open the Gitlab CE web screen for the first time, for this we open the web page in our browser. This page will be that of our server but, being the first time, we have to change the password that the system has by default. Once we have changed the password, we have to register or login with the new password and the "root" user. With this we will have the private configuration area of ​​the Gitlab system on our Ubuntu server.

If our server is for public use, surely we will need to use the https protocol, a web protocol that uses certificates to make web browsing more secure. We can use any certificate but Gitlab CE does not automatically change the url of the repository, to have this we have to do it manually, so we edit the file /etc/gitlab/gitlab.rb and in external_URL we have to change the old address for the new oneIn this case, it will be to add the letter "s", but we can also make the url different and increase the security of our web server. Once we save and close the file, we have to write the following in the terminal so that the changes made are accepted:

sudo gitlab-ctl reconfigure

This will make all the changes we make to the Gitlab software take effect and ready for users of this version control system. Now we can use this software without any problem and without paying anything to have private repositories.

Gitlab or GitHub which is better?

Code dropping as it happens in Gitlab

At this point, surely many of you will wonder what software is better to use or create repositories of our software. Whether to continue with Github or whether to switch to Gitlab. They both use Git and can be changed or easily move created software from one repository to another. But personally I recommend continuing with Github if we have it on our server and if we do not have anything installed, then yes install Gitlab. The reason for this is because I think that productivity is above all, and changing one software for another whose advantages are almost minimal does not compensate.

The good thing about it is that both tools are Free Software and if we know create a virtual machine, we can test both programs and see which one suits us without changing or damaging our Ubuntu server.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

5 comments, leave yours

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Edgar Albalate Ibanez said

    I use another alternative called gitea. You can try it in

  2.   justindam said

    Our dinosaur games offer amusement with animals from millions of years ago! You can manage neanderthals and all kinds of dinos; Tyrannosaurus Rex, Velociraptors, as well as Brachiosaurus are all consisted of! Our dinosaurs levels contain various sorts of gameplay, from fighting to experience to online poker. You can play any kind of sort of obstacle you want, giving you prehistoric entertainment for hrs on end! Fight as cavemen versus creatures, wander the Earth, and also eat your adversaries!

  3.   LelandHoR said

    The globe's very first browser-based First Person Egger! Obtain breaking! Select your class and also end your enemies with eggstreme bias in this 3d multplayer shooter. Gear up lethal tools like the Scramble Shotgun as well as EggK47 as you cluck your way to victory. Appreciate Shellshockers Unblocked

  4.   wilburnmosum said