Setting Up a GitLab Server on Ubuntu 16.04 in a Local LAN
GitLab is as powerful as GitHub. We decided to migrate our version control system from SVN to Git and host our own GitLab server within our local area network (LAN). I found most GitLab installation tutorials to be overly long and complex, especially for environments without a domain name, so I wrote this guide to simplify the process.
Before installing GitLab, update your Ubuntu repositories:
sudo apt-get update
Install the necessary prerequisite packages:
sudo apt install curl openssh-server ca-certificates postfix
During the Postfix installation, select “Internet Site” and enter a server domain name for sending emails. If you don’t have one, feel free to enter any name you like.
Add the GitLab repository using the curl command:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
This step is important. I believe this is one of the most efficient ways to install GitLab, as it allows us to install the package using a simple command once the repository is added:
sudo apt install gitlab-ce
Next, update the configuration file:
sudo vim /etc/gitlab/gitlab.rb
Since we do not have a domain name for our GitLab server, we will use the IP address and continue using the http protocol:
external_url 'http://your_ipaddress'
Then, run the reconfiguration command:
sudo gitlab-ctl reconfigure
That’s it.
For users who simply want to set up a GitLab service in a local LAN, the installation is now complete. Note that there are additional steps required if you have a domain name and wish to enable HTTPS. You should now be able to access your GitLab instance via its IP address from within your local network.
502 Whoops, GitLab is taking too much time to respond.
If you consistently receive the error message “502 Whoops, GitLab is taking too much time to respond” when accessing GitLab, you need to check the ports on your server. In my case, another service was running on port 8080, which is also required by Puma in GitLab. Simply change the Puma port in /etc/gitlab/gitlab.rb and reconfigure:
puma['port'] = some_port_here
This resolved the issue for me; I hope it helps you as well.
References
how-to-install-and-configure-gitlab-on-ubuntu-16-04 [digitalocean]
how-to-install-and-configure-gitlab-on-ubuntu-16-04 [howtoforge]