How To Install Google Cloud SDK on Ubuntu 20.04

Channel: Linux
Abstract: which allow you to quickly install Google Cloud SDK on Ubuntu system. This tutorial describe you to how to install Google Cloud SDK on Ubuntu 20.04 LT

Google Cloud SDK (Software Development Kit) provides a set of tools that are used to manage resources hosted on Google Cloud Platform (GCP). The SDK provides gcloud, gsutil, nd bq commands with the ability to access the Google Cloud via the terminal.

The Cloud SDK team provides official PPA for the Debian packages to install on Ubuntu systems. Also the Cloud SDK is available in form of Snap package, which allow you to quickly install Google Cloud SDK on Ubuntu system.

This tutorial describe you to how to install Google Cloud SDK on Ubuntu 20.04 LTS Linux system.

Prerequisites

Login to your Ubuntu system with a sudo privileged account.

Open a terminal and execute the following commands to install required packages on your system.

sudo apt update 
sudo apt install apt-transport-https ca-certificates gnupg 
Install Google Cloud SDK on Ubuntu

Google Cloud SDK can be installed using Apt repository as well as Snap package. Choose one of the below method for installing Google Cloud SDK on Ubuntu 20.04 system.

The Snap package doesn’t contain kubectl, So to use kubectl you must use Apt repository installation method.

Method 1 – Using Apt Repository

Follow below steps:

  1. First of all, import the apt GPG key to your system with below command.
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - 
    
  2. Then create a PPA file in your system with referring to the cloud-sdk in Google packages repository.
    echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list 
    
  3. Finally, update the apt cache and install Google Cloud Packages on your Ubuntu system
    sudo apt update  
    sudo apt install google-cloud-sdk 
    
  4. Press ‘y’ and hit enter for any confirmation asked by the installer.

That’s it. You have successfully install Google Cloud SDK on your Ubuntu 20.04 Linux system.

Method 2 – Using Snap Package

Google Cloud SDK are available in Snap Store for installing on Linux systems. The Snap daemon is default installed on Ubuntu 20.04. Open a terminal and execute the following command to install Google Cloud SDK using Snap tool on Ubuntu system.

sudo snap install google-cloud-sdk --classic 

This will install google-cloud-sdk on your Ubuntu system. Also upgrade it automatically in background.

Initialize Cloud SDK

After you install Cloud SDK successfully on your system. The next step is to perform initialize the environment with gcloud init command. This authorizes Cloud SDK tools to use your Google account credentials to access Google Cloud and manage it.

sudo gcloud init 

If you are login with remote shell access, use --console-only to prevent from launching a browser-based authorization.

gcloud init --console-only 

Complete the onscreen instructions to initialize your system. For more details read official instructions to initialize Cloud SDK environment.

You can again run gcloud init in future to update Cloud SDK settings or create a new configuration.

Conclusion

This tutorial helped you to install Google Cloud SDK on Ubuntu 20.04 LTS Linux system.

Next, you can refer official gcloud comamnd line reference to start working with it.

Ref From: tecadmin
Channels: SDKGoogle Cloud

Related articles