Install GitLab on your VPS to host a repository (Tutorial)
Why install GitLab on your VPS?
GitLab is an open source application that offers a graphical user interface (GUI) to help manage Git repositories. It includes lots of features, such as issue tracking and easy pull requests and merges.
Today, we’ll walk you through how to install GitLab on your VPS running Ubuntu, Debian or CentOs.
- A VPS running Ubuntu 16.04/18.04, Debian 8/9/10, or CentOS 7
- A regular (non-root) account with sudo privileges. See our SSH keys tutorial for more information.
- A VPS that meets the hardware requirements. Any 8GB or larger VPS from SSD Nodes should to the trick.
To get ready to install GitLab on your VPS, you need to install some dependencies.
Luckily, they’re available in default repositories:
$ sudo apt install curl openssh-server ca-certificates postfix
$ sudo yum install curl policycoreutils openssh-server openssh-clients $ sudo systemctl enable sshd $ sudo systemctl start sshd $ sudo yum install postfix $ sudo systemctl enable postfix $ sudo systemctl start postfix $ sudo firewall-cmd --permanent --add-service=http $ sudo systemctl reload firewalld
First, you need to add the GitLab repository, and then install the package.
Note: We recommend that you check all scripts you’re executing as the sudo user before you execute them. You can find GitLab’s install script here.
$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash $ sudo apt install gitlab-ce
$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash $ sudo yum install gitlab-ce
This operation might take a bit to complete.
When it’s done, you’ll see the following output:
*. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ / /_/ / / /_/ /___/ /_/ / /_/ / ____/_/__/_____/__,_/_.___/ gitlab: Thank you for installing GitLab! gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND: sudo gitlab-ctl reconfigure
You’ve now installed GitLab on your VPS, so let’s fire it up and make sure it’s running smoothly.
See that command above? Give it a whirl.
$ sudo gitlab-ctl reconfigure
You’ll see quite a bit of output as the script operates.
If you need to make any changes to the external URL, for example, or any of the other configuration options, you can edit the
gitlab.rb script and then re-run the configuration.
$ sudo nano /etc/gitlab/gitlab.rb $ sudo gitlab-ctl reconfigure
IMPORTANT: If you followed our previous tutorial on installing a LEMP stack, you will need to configure GitLab to work with your existing nginx installation. GitLab has detailed instructions on how to configure the connection in their documentation.
Once you’ve made any changes to GitLab’s configuration and it’s up and running without errors, you can direct your web browser to the default external URL, or the one you chose.
If you see the following page, you’ve successfully installed GitLab!
Provide a password for the administrator account when prompted.
Then enter the password you choose, and then you’ll be directed to a login screen.
The administrator username is
root by default. Enter that plus the password you just created, and you’ll be ready to start managing your Git repositories directly on your own VPS!