In this article, we will show you how to install GitLab Community Edition on an Ubuntu 18.04 Cloud VPS.
GitLab is an open source application that allows a team or developer to manage their project on their own servers – it’s an alternative to GitHub.
GitLab comes in two editions: Community Edition, and Enterprise Edition. We’ll be installing Community Edition in this tutorial.
GitLab Community Edition is designed to be hosted on your own infrastructure. It provides flexibility in deploying as an internal repository store for a development team, a public way to interface with users, or a means for contributors to host their own projects.
GitLab also provides teams a single data store, one user interface, and one permission model across the DevOps life-cycle, allowing teams to collaborate which would significantly reduce cycle time and focus exclusively on building great software quickly. It’s really an excellent platform for collaboration, so let’s get started with the installation.
Make sure your server met the following requirements.
- 8GB of RAM memory or higher
- 2 or more CPU cores
- Fresh Ubuntu 18.04 Installation
For more details about hardware requirements, please refer to this link.
Step 1. Update the System and Install the Dependencies
Log in to your server via SSH:
ssh [email protected]<span style="color: #ff0000;">server_ip</span>
Before starting with the GitLab installation, it is a good idea to update the system packages to their latest versions.
sudo apt-get update sudo apt-get upgrade
Install the dependencies by running the following command:
sudo apt-get install ca-certificates curl openssh-server postfix
When asked to choose the mail server configuration type, select “Internet Site”.
Step 2. Install GitLab
To install GitLab CE (Community Edition), first you need to enable the GItlab package repository by executing the following command:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Once the repository is added, run the following command to install GitLab Community Edition on your Ubuntu 18.04 server:
sudo EXTERNAL_URL="http://<span style="color: #ff0000;">your_gitlab_domain.com</span>" apt-get install gitlab-ce
Make sure you change
your_gitlab_domain.com with your domain.
The installation will take a few minutes to complete. It will automatically configure and install the Nginx web server to run GitLab at the specified URL.
Once completed, the following message will be printed on your screen:
Running handlers: Running handlers complete Chef Client finished, 455/646 resources updated in 03 minutes 27 seconds gitlab Reconfigured! *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! GitLab should be available at http://your_gitlab_domain.com For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Open your web browser and navigate to your server IP address or domain name you previously set for
EXTERNAL_URL. Log in using “root” as the username. You will be prompted to create a new password.
You can change the “root” username in Settings -> Account.
That’s it, GitLab has been successfully installed and running on your Ubuntu 18.04 server – you and your team can start working with it now.
You can use the
gitlab-ctl command line utility to manage your GitLab instillation . For example, you can start/stop it using the following commands:
sudo gitlab-ctl start
sudo gitlab-ctl stop
Step 3. Let’s Encrypt Configuration
Let’s Encrypt is enabled by default in GitLab if the
external_url is set with the
https protocol. If you used the
http protocol when installing GitLab, you can enable Let’s Encrypt by opening the
/etc/gitlab/gitlab.rb file and edit the following entries:
letsencrypt['enable'] = true external_url "https://<span style="color: #ff0000;">your_gitlab_domain.com</span>"
Make sure you run
sudo gitlab-ctl reconfigure after enabling Let’s Encrypt.
Step 4. Email Configuration
By default, GitLab will use Sendmail to send emails from the application. If you want to use the Google SMTP server instead the default Sendmail, open the GitLab configuration file
/etc/gitlab/gitlab.rb and make the following changes:
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.gmail.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "[email protected]" gitlab_rails['smtp_password'] = "my-gmail-password" gitlab_rails['smtp_domain'] = "smtp.gmail.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = false gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
Once you are done, save the file. You can then run the following command for the changes to take effect:
$ sudo gitlab-ctl reconfigure
Step 5. Create a Backup of GitLab
Use the following command to create a backup of your GitLab instance:
$ sudo gitlab-rake gitlab:backup:create
By default the backup is stored in
/var/opt/gitlab/backups directory. You can change the backup path by editing the appropriate settings in the GitLab configuration file found at
For example, if you want to store your GitLab backups in the
/mnt/backups, make the following changes to the
gitlab_rails['backup_path'] = '/mnt/backups'
Once done, run
sudo gitlab-ctl reconfigure
You can also create a cron job to backup your GitLab data.
0 3 * * 2-6 gitlab-rake gitlab:backup:create
Congratulations! You have installed and configured GitLab for your Ubuntu 18.04 Cloud VPS.
Of course, you don’t have to install GitLab on Ubuntu 18.04 if you use one of our Cloud VPS Hosting services. If you do, you can simply ask our support team to install GitLab on Ubuntu 18.04 for you. They are available 24/7 and will be able to help you with the installation of GitLab.
PS. If you enjoyed reading this blog post on how to install GitLab on Ubuntu 18.04, or if you found it helpful, feel free to share it on social networks using the shortcuts below, or simply leave a comment. Thank you.