2018-05-09 07:07:11 -04:00
---
description: 'Learn how to install a GitLab instance on Google Cloud Platform.'
2019-05-23 20:48:08 -04:00
type: howto
2018-05-09 07:07:11 -04:00
---
2017-03-02 07:55:29 -05:00
# Installing GitLab on Google Cloud Platform
2020-04-21 11:21:10 -04:00
This guide will help you install GitLab on a [Google Cloud Platform (GCP) ](https://cloud.google.com/ ) instance.
2017-03-02 07:55:29 -05:00
2019-05-23 20:48:08 -04:00
NOTE: **Alternative installation method:**
2019-04-11 06:56:44 -04:00
Google provides a whitepaper for [deploying production-ready GitLab on
Google Kubernetes Engine](https://cloud.google.com/solutions/deploying-production-ready-gitlab-on-gke),
including all steps and external resource configuration. These are an alternative to using a GCP VM, and use
2019-04-15 12:34:25 -04:00
the [Cloud native GitLab Helm chart ](https://docs.gitlab.com/charts/ ).
2019-04-11 06:56:44 -04:00
2017-03-02 07:55:29 -05:00
## Prerequisites
There are only two prerequisites in order to install GitLab on GCP:
1. You need to have a Google account.
1. You need to sign up for the GCP program. If this is your first time, Google
2020-04-21 11:21:10 -04:00
gives you [$300 credit for free ](https://console.cloud.google.com/freetrial ) to consume over a 60-day period.
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
Once you have performed those two steps, you can [create a VM ](#creating-the-vm ).
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
## Creating the VM
2017-03-02 07:55:29 -05:00
2019-05-23 20:48:08 -04:00
To deploy GitLab on GCP you first need to create a virtual machine:
2017-03-02 07:55:29 -05:00
2019-05-23 20:48:08 -04:00
1. Go to < https: // console . cloud . google . com / compute / instances > and log in with your Google credentials.
2018-02-16 10:47:34 -05:00
1. Click on **Create**
2017-03-02 07:55:29 -05:00
2019-07-11 11:21:26 -04:00
![Search for GitLab ](img/launch_vm.png )
2017-03-02 07:55:29 -05:00
2019-07-11 11:21:26 -04:00
1. On the next page, you can select the type of VM as well as the
2020-06-04 08:08:21 -04:00
estimated costs. Provide the name of the instance, desired datacenter, and machine type.
Note our [hardware requirements for different user base sizes ](../requirements.md#hardware-requirements ).
2017-03-02 07:55:29 -05:00
2019-07-11 11:21:26 -04:00
![Launch on Compute Engine ](img/vm_details.png )
2017-03-02 07:55:29 -05:00
2020-06-04 08:08:21 -04:00
1. To select the size, type, and desired [operating system ](../requirements.md#supported-linux-distributions ),
click **Change** under `Boot disk` . Click **Select** when finished.
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
1. As a last step allow HTTP and HTTPS traffic, then click **Create** . The process will finish in a few seconds.
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
## Installing GitLab
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
After a few seconds, the instance will be created and available to log in. The next step is to install GitLab onto the instance.
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
![Deploy settings ](img/vm_created.png )
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
1. Make a note of the IP address of the instance, as you will need that in a later step.
1. Click on the SSH button to connect to the instance.
1. A new window will appear, with you logged into the instance.
2017-03-02 07:55:29 -05:00
2019-07-11 11:21:26 -04:00
![GitLab first sign in ](img/ssh_terminal.png )
2017-03-02 07:55:29 -05:00
2019-07-08 18:24:54 -04:00
1. Next, follow the instructions for installing GitLab for the operating system you choose, at < https: // about . gitlab . com / install /> . You can use the IP address from the step above, as the hostname.
2017-03-02 07:55:29 -05:00
2018-02-16 10:47:34 -05:00
1. Congratulations! GitLab is now installed and you can access it via your browser. To finish installation, open the URL in your browser and provide the initial administrator password. The username for this account is `root` .
2019-07-11 11:21:26 -04:00
![GitLab first sign in ](img/first_signin.png )
2017-03-02 07:55:29 -05:00
## Next steps
These are the most important next steps to take after you installed GitLab for
the first time.
### Assigning a static IP
By default, Google assigns an ephemeral IP to your instance. It is strongly
recommended to assign a static IP if you are going to use GitLab in production
and use a domain name as we'll see below.
2019-09-27 05:06:26 -04:00
Read Google's documentation on how to [promote an ephemeral IP address ](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address#promote_ephemeral_ip ).
2017-03-02 07:55:29 -05:00
### Using a domain name
Assuming you have a domain name in your possession and you have correctly
set up DNS to point to the static IP you configured in the previous step,
here's how you configure GitLab to be aware of the change:
1. SSH into the VM. You can easily use the **SSH** button in the Google console
and a new window will pop up.
2019-07-11 11:21:26 -04:00
![SSH button ](img/vm_created.png )
2017-03-02 07:55:29 -05:00
2020-04-21 11:21:10 -04:00
In the future you might want to set up [connecting with an SSH key ](https://cloud.google.com/compute/docs/instances/connecting-to-instance )
2019-07-11 11:21:26 -04:00
instead.
2017-03-02 07:55:29 -05:00
1. Edit the config file of Omnibus GitLab using your favorite text editor:
2020-03-23 23:09:28 -04:00
```shell
2019-07-11 11:21:26 -04:00
sudo vim /etc/gitlab/gitlab.rb
```
2017-03-02 07:55:29 -05:00
1. Set the `external_url` value to the domain name you wish GitLab to have
**without** `https` :
2020-03-23 23:09:28 -04:00
```ruby
2019-07-11 11:21:26 -04:00
external_url 'http://gitlab.example.com'
```
2017-03-02 07:55:29 -05:00
2019-07-11 11:21:26 -04:00
We will set up HTTPS in the next step, no need to do this now.
2017-03-02 07:55:29 -05:00
1. Reconfigure GitLab for the changes to take effect:
2020-03-23 23:09:28 -04:00
```shell
2019-07-11 11:21:26 -04:00
sudo gitlab-ctl reconfigure
```
2017-03-02 07:55:29 -05:00
1. You can now visit GitLab using the domain name.
### Configuring HTTPS with the domain name
Although not needed, it's strongly recommended to secure GitLab with a TLS
2020-04-21 11:21:10 -04:00
certificate. Follow the steps in the [Omnibus documentation ](https://docs.gitlab.com/omnibus/settings/nginx.html#enable-https ).
2017-03-02 07:55:29 -05:00
### Configuring the email SMTP settings
You need to configure the email SMTP settings correctly otherwise GitLab will
not be able to send notification emails, like comments, and password changes.
2020-04-21 11:21:10 -04:00
Check the [Omnibus documentation ](https://docs.gitlab.com/omnibus/settings/smtp.html#smtp-settings ) how to do so.
2017-03-02 07:55:29 -05:00
## Further reading
GitLab can be configured to authenticate with other OAuth providers, LDAP, SAML,
Kerberos, etc. Here are some documents you might be interested in reading:
- [Omnibus GitLab documentation ](https://docs.gitlab.com/omnibus/ )
2019-07-05 12:25:58 -04:00
- [Integration documentation ](../../integration/README.md )
- [GitLab Pages configuration ](../../administration/pages/index.md )
2019-09-17 08:06:48 -04:00
- [GitLab Container Registry configuration ](../../administration/packages/container_registry.md )
2017-03-02 07:55:29 -05:00
2019-05-23 20:48:08 -04:00
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X` .
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->