How to Setup Google Cloud CLI (gcloud cli) on Ubuntu

The gcloud CLI manages authentication, local configuration, developer workflow, interactions with Google Cloud APIs. With the gcloud command-line tool,.it’s easy to perform many common cloud tasks, like creating a Compute Engine VM instance, and deploying an App Engine application, either from the command line or in scripts and other automations.

 

  • Add the Cloud SDK distribution using the following command:-

echo “deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main” | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

  • Import the Google Cloud public key:

          curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key –keyring /usr/share/keyrings/cloud.google.gpg add –

 

Fig 1

 

  • Update and install the Cloud SDK:

sudo apt-get update && sudo apt-get install google-cloud-sdk

 

Fig 2

 

  • Press Y & Enter.
  • Install any of these additional components:

         sudo apt-get install google-cloud-sdk-app-engine-java google-cloud-sdk-app-engine-python google-cloud-sdk-pubsub-emulator google-cloud-sdk-bigtable-emulator google-cloud-sdk-datastore-emulator kubectl

 

Fig. 4

 

  • Run gcloud init to get started:

gcloud init

 

  • Then click on link & provide your mail-id & password.

 

Fig. 6

 

  • Click on Allow.

Fig. 7

 

  • Copy the verification code.

Fig. 8

 

  • Paste the code on Terminal.

 

Fig. 9

 

  • Enter a number & Select your project or Create a new project.

 

Fig.10

 

  • Select Region & Zone.
  • Google Cloud SDK is now configured and ready to use!

 

Leave a Reply