{"id":124,"date":"2019-09-30T09:00:00","date_gmt":"2019-09-30T09:00:00","guid":{"rendered":"http:\/\/ssdnodes.billabailey.com\/2017\/04\/03\/tutorial-setting-up-your-own-gitlab-repository\/"},"modified":"2025-05-18T19:33:53","modified_gmt":"2025-05-18T19:33:53","slug":"install-gitlab-vps-ubuntu-debian-centos","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/install-gitlab-vps-ubuntu-debian-centos\/","title":{"rendered":"Install GitLab On Your VPS To Host A Repository (Tutorial)"},"content":{"rendered":"<h2>Why install GitLab on your VPS?<\/h2>\n<p>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.<\/p>\n<p>If you don't want to pay for <a href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noopener\">GitHub\u2019s<\/a> or <a href=\"https:\/\/bitbucket.org\/product\" target=\"_blank\" rel=\"noopener\">Bitbucket\u2019s<\/a> paid features, or if you want to maintain full control over your codebase, then a self-hosted GitLab installation is a great option.<\/p>\n<p>Today, we'll walk you through how to install GitLab on your VPS running Ubuntu, Debian or CentOs.<\/p>\n<h2>Prerequisites for GitLab installation:<\/h2>\n<ul>\n<li>A VPS running Ubuntu 16.04\/18.04, Debian 8\/9\/10, or CentOS 7<\/li>\n<li>A regular (non-root) account with sudo privileges. See our <a href=\"https:\/\/www.ssdnodes.com\/blog\/connecting-vps-ssh-security\/\">SSH keys tutorial<\/a> for more information.<\/li>\n<li>A VPS that meets the <a href=\"http:\/\/docs.gitlab.com\/ee\/install\/requirements.html#hardware-requirements\" target=\"_blank\" rel=\"noopener\">hardware requirements<\/a>. Any <a href=\"https:\/\/www.ssdnodes.com\">8GB or larger VPS from SSD Nodes<\/a> should to the trick.<\/li>\n<\/ul>\n<h2>Step 1: Installing dependencies<\/h2>\n<p>To get ready to install GitLab on your VPS, you need to install some dependencies.<\/p>\n<p>Luckily, they\u2019re available in default repositories:<\/p>\n<h3>Ubuntu 16.04\/18.04, Debian 8\/9\/10<\/h3>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo apt install curl openssh-server ca-certificates postfix\r\n<\/code><\/pre>\n<h3>Centos 7<\/h3>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo yum install curl policycoreutils openssh-server openssh-clients\r\n$ sudo systemctl enable sshd\r\n$ sudo systemctl start sshd\r\n$ sudo yum install postfix\r\n$ sudo systemctl enable postfix\r\n$ sudo systemctl start postfix\r\n$ sudo firewall-cmd --permanent --add-service=http\r\n$ sudo systemctl reload firewalld\r\n<\/code><\/pre>\n<h2>Step 2: Installing GitLab on VPS<\/h2>\n<p>First, you need to add the GitLab repository, and then install the package.<\/p>\n<blockquote><p>Note: We recommend that you check all scripts you're executing as the sudo user before you execute them. You can find GitLab's <a href=\"https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/install\" target=\"_blank\" rel=\"noopener\">install script here<\/a>.<\/p><\/blockquote>\n<h3>Ubuntu 16.04\/18.04, Debian 8\/9\/10<\/h3>\n<pre><code class=\"language-shell\" lang=\"shell\">$ curl -s https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash\r\n\r\n$ sudo apt install gitlab-ce\r\n<\/code><\/pre>\n<h3>CentOS 7<\/h3>\n<pre><code class=\"language-shell\" lang=\"shell\">$ curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash\r\n\r\n$ sudo yum install gitlab-ce\r\n<\/code><\/pre>\n<p>This operation might take a bit to complete.<\/p>\n<p>When it\u2019s done, you\u2019ll see the following output:<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">*.                  *.\r\n      ***                 ***\r\n     *****               *****\r\n    .******             *******\r\n    ********            ********\r\n   ,,,,,,,,,***********,,,,,,,,,\r\n  ,,,,,,,,,,,*********,,,,,,,,,,,\r\n  .,,,,,,,,,,,*******,,,,,,,,,,,,\r\n      ,,,,,,,,,*****,,,,,,,,,.\r\n         ,,,,,,,****,,,,,,\r\n            .,,,***,,,,\r\n                ,*,.\r\n\r\n     _______ __  __          __\r\n    \/ ____(_) \/_\/ \/   ____ _\/ \/_\r\n   \/ \/ __\/ \/ __\/ \/   \/ __ `\/ __ \r\n  \/ \/_\/ \/ \/ \/_\/ \/___\/ \/_\/ \/ \/_\/ \/\r\n  ____\/_\/__\/_____\/__,_\/_.___\/\r\n\r\ngitlab: Thank you for installing GitLab!\r\ngitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:\r\n\r\nsudo gitlab-ctl reconfigure\r\n<\/code><\/pre>\n<h2>Step 3: Run and configure GitLab<\/h2>\n<p>You've now installed GitLab on your VPS, so let's fire it up and make sure it\u2019s running smoothly.<\/p>\n<p>See that command above? Give it a whirl.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo gitlab-ctl reconfigure\r\n<\/code><\/pre>\n<p>You'll see quite a bit of output as the script operates.<\/p>\n<p>If you need to make any changes to the external URL, for example, or any of the other configuration options, you can edit the <code>gitlab.rb<\/code> script and then re-run the configuration.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo nano \/etc\/gitlab\/gitlab.rb\r\n$ sudo gitlab-ctl reconfigure\r\n<\/code><\/pre>\n<p><strong>IMPORTANT<\/strong>: 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 <a href=\"https:\/\/gitlab.com\/gitlab-org\/omnibus-gitlab\/blob\/master\/doc\/settings\/nginx.md#using-a-non-bundled-web-server\" target=\"_blank\" rel=\"noopener\">detailed instructions<\/a> on how to configure the connection in their documentation.<\/p>\n<div class=\"cta-inline\"><\/div>\n<h2>Step 4: Log into GitLab for the first time<\/h2>\n<p>Once you\u2019ve made any changes to GitLab\u2019s configuration and it\u2019s up and running without errors, you can direct your web browser to the default external URL, or the one you chose.<\/p>\n<p>If you see the following page, you\u2019ve successfully installed GitLab!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/12263278\/65494409-b68dd380-deac-11e9-8508-30082da0f3b2.png\" alt=\"GitLab Success\" \/><\/p>\n<p>Provide a password for the administrator account when prompted.<\/p>\n<p>Then enter the password you choose, and then you\u2019ll be directed to a login screen.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/12263278\/65494526-eccb5300-deac-11e9-9bf5-ef56d1f43d0a.png\" alt=\"GitLab Login\" \/><\/p>\n<p>The administrator username is <code>root<\/code> by default. Enter that plus the password you just created, and you\u2019ll be ready to start managing your Git repositories directly on your own VPS!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":20,"featured_media":125,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[215,252],"class_list":["post-124","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-git","tag-gitlab"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":5,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":13056,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/124\/revisions\/13056"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/125"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}