GitLab Installation Documentation

Prerequisites

  • Dedicated Virtual or Physical Machine
  • 4gb of ram
  • 40 gb of memory
  • CPU with 4 processors with 1 core each
  • Pre configured (preferably hardened) Debian 11 system

Why?

It can be handy to have a private code repository to work from. Whether this is for a propitiatory project or just storing a bunch of personal projects locally. This is also a good exercise in finding and deploying a service on a local server.

Notes before starting

  • This is intended to be a page for documentation and a couple lessons learned for local installations of gitlab

Installation Documentation

1. Following along with the installation guide I used the following script to start off the installation.

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates perl
sudo apt-get install -y postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
sudo apt-get install gitlab-ee

2. Once the installation was complete the following screen was produced informing me that the installation was not able to be completed because the EXTERNAL_URL was not set. I did not set it because the local installation does not have a FQDN (Fully Qualified Domain Name) and I was not interested in messing with getting the HTTPS certificate working. HOWEVER it should be noted that for a system that is on an in production network the SSL certificates should be installed and configured with the server IP address registered either in a local Domain Name Server or registering it with a DNS service provider. Now back to the installation.

3. I set the external_url in the configuration file to the LAN IP address and reconfigured the installation using the command sudo gitlab-ctl reconfigure

4. This hung the system up for some reason and it completely stopped working. When commands were entered into the "physical" terminal the commands were sent to the stdout on all other terminals remote and local. This lead me to believe that one of the three possible issues were occurring:

  • The installation was Broken
  • There was too little RAM or CPU's
  • The physical memory was taken up

5. I started from the top down and reinstalled the service to see if it fixed the issue:

       apt remove gitlab-ee
       sudo EXTERNAL_URL="https://gitlab.local" apt-get install gitlab-ee

Note: After reviewing these notes I realized that I had used the https:// prefix for the EXTERNAL_URL variuble. It does not matter too much here because I will uninstall and reinstall the gitlab installation later on. But if you are following along then its something that should be kept in mind.

6. This once again froze the system for a time, so it was not a broken installation It must have been a lack of resources. While the installation was frozen and the terminal was working (very very slowly but still working) I was able to pull up top and check out the df -h output to determine if there was a hardware requirement issue occurring. There was plenty of storage available but the RAM usage was steadily being maxed out so adding hardware it is.

7. I had 2gb of RAM and 2 virtual CPUS installed which was barely enough for the system to run after reviewing the system requirements from the gitlab documentation it requires 4gb and 4 CPUs. The reason I had so little resources allocated to the machine was because I just figured gitlab was just a webserver and had not taken into account the advanced features that take up a significant amount of information.

8. To update the virtual hardware the development server was shut down, RAM was added and the number of CPU’s were increased. I was worried that I would need to reinstall the machine after increasing the number of CPU's but the machine booted and functioned without any issues.

9. Next I uninstalled and reinstalled the gitlab-ee service using the following code

apt remove gitlab-ee
sudo EXTERNAL_URL="http://IP-ADDRESS" apt-get install gitlab-ee

Note: here is where the url was changed to be the LAN IP address and the protocol prefix was changed from https to http

10. After the apt installation the following error was given

It looks like there was a problem with public attributes; run gitlab-ctl reconfigure manually to fix.

11. After running the gitlab-ctl reconfigure command and a number of minutes the service was installed and was up and running on port 80!

12. To log into the system the default password that can be found in the following file /etc/gitlab/initial_root_password

13. After setting up MFA and configuring some gui settings Next thing to do was make an unprivalaged user to use the system as. That process was completed as follows:

a) First be sure you are the administrator

b) Click on the hamburger menu in the upper left of the webpage and navigate to the admin pannel

c) Once you find yourself in the Admin panel find the Instance overview section and click the New user button

d) After setting up the user account setting limits, socials, avatar etc. You will either be taken to the Overview ? Users section or you will need to navigate to it and find the new user.

e) Once you find the selected user then select the Edit button and set the users new password

14. This new user should be able to log in and make repositories. This walk through is only for installation and does not go into the advanced configuration options.

Conclusion

I had some fun and only lost a few hairs setting up a gitlab server. This process took around an hour or two including user setup. The gitlab server ran in my lab for a few days without any issues, and just like a sand mandala the VM was deleted and the memory freed up for future projects. I hope you enjoyed reading about this project if you liked it then follow me on LinkedIn @Nicholas Howland or send an email to contact@exylum.tech.

Thank you for reading!

- Nick