Install Google Cloud SDK on Ubuntu 20.04 - Best Method ?

Google provides a set of tools and utilities to help users manage resources hosted on GCP (Google Cloud Platform ). This set of tools is collectively referred to as Google Cloud SDK, short for Software Development Kit. The Google Cloud SDK comprises gcloud, gsutil, and bq command line utilities.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Google Cloud SDK queries.

In this context, we shall look into different methods to install Google Cloud SDK on Ubuntu 20.04. You can install Google Cloud SDK from the official Ubuntu APT repository or using Snap packages.

How to Install Google SDK from Ubuntu repository ?

Google Provides an official repository from which you can install the Google SDK on your system. Ideally, this is what you would consider since it provides the latest SDK packages from the official repository.

But first, make a point of updating your package lists as shown:

$ sudo apt update
$ sudo apt install curl apt-transport-https ca-certificates gnupg

Next, create the Google SDK repository file as shown:

$ sudo vim /etc/apt/sources.list.d/google-cloud-sdk.list

And add the line below:

deb [signed-by=/usr/share/keyrings/] cloud-sdk main

With the repository added, download the public key for Google Cloud as shown:

$ curl | sudo apt-key --keyring /usr/share/keyrings/ add -

Then sync the newly added repository with Google repositories by updating the package index:

$ sudo apt update

Finally, install the Google SDK from the Ubuntu repository as follows:

$ sudo apt install google-cloud-sdk

Then, Type 'Y' to continue with the installation of Google SDK packages and dependencies.

How to Install Google SDK using Snap packages ?

By default, snap is enabled on Ubuntu 18.04 and later versions.

Thus, you can install the SDK using a single command as shown:

$ sudo snap install google-cloud-sdk --classic

This takes a bit of time since snap packages are quite bulky in size.

How to Initialize Google SDK ?

After the installation, of which any of the two methods should work, the only thing remaining is to initialize it. To do so, execute the command:

$ sudo gcloud init

The command provides you to continue. Simply press 'Y' to proceed. A link to log in to your Google account will be provided. You can click on it directly or copy and paste it on a browser.

Here, provide your login credentials to your Google account.

[Need help to install Software packages on Debian Linux System? We can help you today. ]

This article covers how to Install and Set Up Google Cloud SDK on Ubuntu 20.04. The Google Cloud SDK provides us with the ability to access the Google Cloud via the terminal. It is a development toolkit that comes with multiple commands that help in managing the resources within the Google Cloud environment. 

Related Posts