Hint: You can use the Tab key to autocomplete all filenames and directories, so you don't have to type in the complete file or directory name manually.

This tutorial was last checked and updated on September 8, 2019.

Are you looking for very good, powerful and cheap servers? I've been renting my servers at Contabo for 6 years now and I can highly recommend Contabo to everyone!
  1. If you havn't already done so, download the program "PuTTY".
  2. Connect to your root server or VPS/vServer via SSH using PuTTY. To do this, open PuTTY and enter the domain or IP address of your server in the text box named "Host Name (or IP address)". Then click the "OK" button below.
  3. Update your package lists with the command apt update.
  4. Now install any available updates of the packages already installed on your server using the command apt upgrade -y.
  5. Next, install the packages needed for future installations in this tutorial by executing the following command: apt install curl nano -y
  6. If you want to use your own mail server to send e-mails (e.g. for user account activations), then I recommend the Mailcow mail server. I've also published a tutorial for this. Alternatively, you can also use Postfix, but Mailcow is recommended. However, if you want to install Postfix, use the command apt install postfix -y, select "internet site" during the installation and enter your domain as the "system e-mail name". If you want to use an external SMTP server (Gmail, Mailgun etc.) or Mailcow to send e-mails from GitLab, then skip this step and continue with step 10 of this tutorial after you've installed GitLab (SMTP configuration).
  7. Add the repository needed to install GitLab by executing the command curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | bash.
  8. Now update your package lists again with the command apt update.
  9. Install GitLab and other required packages with the following command: EXTERNAL_URL="http://gitlab.domain.com" apt install gitlab-ee -y. Replace "http://gitlab.domain.com" with the URL, that you want to use to access the GitLab web interface. Note: The default web server port 80 will be used. If a web server like Apache2 is already installed, then you have to choose a different port. In this case, just enter the desired port behind the URL (e.g. "http://gitlab.domain.com:8888" for port 8888).
  10. Optional (if you want to use Mailcow or an external SMTP server to send e-mails) :
    1. Open the GitLab configuration file by executing the command nano /etc/gitlab/gitlab.rb
    2. Go to the SMTP configuration section starting at line 547 of this file and remove the "#" characters on the beginning of lines 547 to 555. Then customize the SMTP configuration to match the SMTP server you want to use. You can find some information, including the SMTP configuration for Mailcow, here.
    3. Save your changes to the configuration by pressing CTRL + X, then hit the "Y" key followed by enter.
    4. Now you have to regenerate the GitLab configuration. To do this, enter the command gitlab-ctl reconfigure and restart GitLab by using the command gitlab-ctl restart.
  11. Next, open the GitLab web interface in your browser under the URL you set during the installation and set a password for the administrator user. The username for this user is "root" by default.
  12. Now you can login with the username "root" and the password you just set to configure and use GitLab.
  13. You can find several configuration parameters in the file "/etc/gitlab/gitlab.rb". For example, to change the URL of your GitLab installation, enter the command nano /etc/gitlab/gitlab.rb to open this file and change the value of the parameter "EXTERNAL_URL" in line 13. Save your changes to the configuration by pressing CTRL + X, then hit the "Y" key followed by enter and regenerate the GitLab configuration using the command gitlab-ctl reconfigure. After you've done this, GitLab needs to be restarted. Use the command gitlab-ctl restart to do this.