What is Google Cloud SDK? Google cloud sdk is a set of tools that enables you to manage your resources hosted on Google Cloud, just like AWS CLI for those who use AWS cloud. Good Cloud SDK presents a number of important command line tools such as gcloud, gsutil and bq that enable effective management of applications and other resources in Google cloud. In this guide, we are going to look at how to install and use Google Cloud SDK on Linux Mint 22 / Ubuntu 24.04.
Update System Packages
The first to always ensure is that you are running on the latest system packages. Update them as below and reboot:
sudo apt update && sudo apt upgrade -y
sudo reboot
Check Python Version
Google Cloud SDK requires Python 2.7.9 or higher. Linux Mint 22 / Ubuntu 24.04 already comes with Python 3 installed. Confirm python version by running the below command:
$ python3 --version
Python 3.12.3
If you do not have Python installed already, run the following command to install it:
sudo apt install python3
Installing Google Cloud SDK on Linux Mint 22 / Ubuntu 24.04
We are going to look at various ways of installing Google SDK on Linux Mint 22 and Ubuntu 24.04. The first method of installation is by adding a Google SDK repository on our systems. The packages that will be installed include gcloud, gsutil, bq, gcloud alpha and gcloud beta. Other tools such as kubectl and App Engine extensions needed for deploying applications with gcloud command will have to be installed separately.
Install Google Cloud SDK using Apt repository
Installed required dependencies as below:
sudo apt-get install apt-transport-https ca-certificates gnupg curl
Next, we import Google cloud SDK public key:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
Run the command below to add Google Cloud SDK repository to sources.list file:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
Finally, update and install Google Cloud SDK.
sudo apt update && sudo apt install google-cloud-sdk
The tools that will be installed as part of Google Cloud SDK include:
- gcloud – called default gcloud CLI command is the tool for interacting with Google Cloud. It works with Google Compute Engine and can be compared to AWS EC2)
- bq (BigQuery Command Line tool) – is the tool that enables working with data in Google BigQuery. Can be compared to AWS Redshift
- gsutil (Cloud storage Command Line) – Used with any operations to do with Google Cloud storage just like AWS S3.
- alpha (gcloud CLI alpha commands) – gcloud CLI commands at the alpha release level.
- beta (gcloud CLI beta commands) – gcloud CLI commands at the alpha release level.
You can then proceed to install additional tools that you may require using apt install. Some of the important tool you may need are as listed:
google-cloud-sdk-app-engine-python
google-cloud-sdk-app-engine-python-extras
google-cloud-sdk-app-engine-java
google-cloud-sdk-app-engine-go
google-cloud-sdk-bigtable-emulator
google-cloud-sdk-cbt
google-cloud-sdk-cloud-build-local
google-cloud-sdk-datalab
google-cloud-sdk-datastore-emulator
google-cloud-sdk-firestore-emulator
google-cloud-sdk-pubsub-emulator
kubectl
For exampe:
sudo apt install google-cloud-sdk-app-engine-python
Install Google Cloud SDK using Snap
Another easy way to install Google cloud SDk on Ubuntu 24.04 and Linux Mint 22 is to use snap package. Simply run the below single command:
sudo snap install google-cloud-sdk --classic
Install Google Cloud SDK using a .tar file
On general Linux x86_64, you can simply download an archived file of Google Cloud SDK and install as below.
#Linux 64-bit (x86_64)
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-515.0.0-linux-x86_64.tar.gz
#Linux 64-bit (ARM)
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-515.0.0-linux-arm.tar.gz
#32-bit
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-515.0.0-linux-x86.tar.gz
Extract the SDK archive:
tar xvf google-cloud-sdk-*.tar.gz
Proceed to install Google Cloud SDK on Linux mint 22 | Ubuntu 24.04 as below:
$ cd google-cloud-sdk
$ ./install.sh
Welcome to the Google Cloud CLI!
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:
gcloud config set disable_usage_reporting false
Do you want to help improve the Google Cloud CLI (y/N)? y
Your current Google Cloud CLI version is: 515.0.0
The latest available version is: 515.0.0
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.7 MiB │
│ Not Installed │ Appctl │ appctl │ 21.0 MiB │
│ Not Installed │ Artifact Registry Go Module Package Helper │ package-go-module │ < 1 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 19.1 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 7.8 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 36.2 MiB │
│ Not Installed │ Cloud Firestore Emulator │ cloud-firestore-emulator │ 46.9 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 62.4 MiB │
│ Not Installed │ Cloud Run Proxy │ cloud-run-proxy │ 13.3 MiB │
│ Not Installed │ Cloud SQL Proxy v2 │ cloud-sql-proxy │ 14.9 MiB │
│ Not Installed │ Cloud Spanner Emulator │ cloud-spanner-emulator │ 37.7 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 1.8 MiB │
│ Not Installed │ Kustomize │ kustomize │ 4.3 MiB │
│ Not Installed │ Log Streaming │ log-streaming │ 18.2 MiB │
│ Not Installed │ Managed Flink Client │ managed-flink-client │ 383.4 MiB │
│ Not Installed │ Minikube │ minikube │ 45.2 MiB │
│ Not Installed │ Nomos CLI │ nomos │ 33.3 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper │ local-extract │ 31.6 MiB │
│ Not Installed │ Skaffold │ skaffold │ 32.6 MiB │
│ Not Installed │ Spanner migration tool │ spanner-migration-tool │ 27.5 MiB │
│ Not Installed │ Terraform Tools │ terraform-tools │ 66.1 MiB │
│ Not Installed │ anthos-auth │ anthos-auth │ 22.0 MiB │
│ Not Installed │ config-connector │ config-connector │ 91.1 MiB │
│ Not Installed │ enterprise-certificate-proxy │ enterprise-certificate-proxy │ 10.5 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.4 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 3.8 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries) │ app-engine-python-extras │ < 1 MiB │
│ Not Installed │ gke-gcloud-auth-plugin │ gke-gcloud-auth-plugin │ 3.5 MiB │
│ Not Installed │ istioctl │ istioctl │ 27.8 MiB │
│ Not Installed │ kpt │ kpt │ 15.1 MiB │
│ Not Installed │ kubectl │ kubectl │ < 1 MiB │
│ Not Installed │ kubectl-oidc │ kubectl-oidc │ 22.0 MiB │
│ Not Installed │ pkg │ pkg │ │
│ Installed │ BigQuery Command Line Tool │ bq │ 1.8 MiB │
│ Installed │ Bundled Python 3.12 │ bundled-python3-unix │ 89.2 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 11.8 MiB │
│ Installed │ Google Cloud CLI Core Libraries │ core │ 21.2 MiB │
│ Installed │ Google Cloud CRC32C Hash Tool │ gcloud-crc32c │ 1.4 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────────┴───────────┘
To install or remove components at your current SDK version [515.0.0], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [515.0.0], run:
$ gcloud components update
Modify profile to update your $PATH and enable shell command completion?
Do you want to continue (Y/n)? y
The Google Cloud SDK installer will now prompt you to update an rc file to bring the Google Cloud CLIs into your environment.
Enter a path to an rc file to update, or leave blank to use [/home/cloudspinx/.bashrc]:
Backing up [/home/cloudspinx/.bashrc] to [/home/cloudspinx/.bashrc.backup].
[/home/cloudspinx/.bashrc] has been updated.
==> Start a new shell for the changes to take effect.
For more information on how to get started, please visit:
https://cloud.google.com/sdk/docs/quickstarts
Close your current terminal or start another one to realize the SDK changes.
Initialize Google Cloud SDK on Ubuntu | Linux Mint
Once you have installed Google Cloud SDK using any of the above described methods, initialize it by running the command below:
$ gcloud init
Welcome! This command will take you through the configuration of gcloud.
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
You must log in to continue. Would you like to log in (Y/n)?
Enter Y to accept and head to your browser and login to your Google cloud user account. Once you login, you will be asked to choose the cloud project to use. You can opt to create a new one. Enter the appropriate number and press Enter:
You are logged in as: [[email protected]].
Pick cloud project to use:
[1] keeweb-294218
[2] myproject-01-181910
[3] skilled-tangent-319513
[4] Create a new project
Please enter numeric choice or text value (must exactly match list
item):
Using Google Cloud SDK on Ubuntu | Linux Mint
There are various operations that you can perform with Google Cloud SDK to manage Google Cloud resources. Check the examples below:
To list all the installed components:
$ gcloud components list
Your current Cloud SDK version is: 515.0.0
The latest available version is: 515.0.0
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬──────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.9 MiB │
│ Not Installed │ Appctl │ appctl │ 21.0 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 7.7 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 6.6 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 18.4 MiB │
│ Not Installed │ Cloud Firestore Emulator │ cloud-firestore-emulator │ 40.4 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 60.4 MiB │
│ Not Installed │ Cloud SQL Proxy │ cloud_sql_proxy │ 7.6 MiB │
│ Not Installed │ Cloud Spanner Emulator │ cloud-spanner-emulator │ 21.8 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Cloud Build Local Builder │ cloud-build-local │ 6.3 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 1.8 MiB │
│ Not Installed │ Kustomize │ kustomize │ 25.9 MiB │
│ Not Installed │ Minikube │ minikube │ 25.5 MiB │
│ Not Installed │ Nomos CLI │ nomos │ 25.6 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper │ local-extract │ 13.6 MiB │
│ Not Installed │ Skaffold │ skaffold │ 17.1 MiB │
│ Not Installed │ anthos-auth │ anthos-auth │ 17.6 MiB │
│ Not Installed │ config-connector │ config-connector │ 48.7 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta
List accounts whose credentials are stored locally
gcloud auth list
To install a component, use the syntax ‘gcloud components install <component name>‘. Example, if you want to install kubectl, use the command as shown:
gcloud components install kubectl
To update all the installed components to the latest available version of Cloud SDK:
gcloud components update
To create a VM using gcloud command line, you will need to pass the specifications for the VM such as instance type, name and image. Check the example below:
export IMAGE_FAMILY="tf-latest-cu92"
export ZONE="us-west1-b"
export INSTANCE_NAME="my-instance"
export INSTANCE_TYPE="n1-standard-8"
And proceed to create the instance:
gcloud compute instances create $INSTANCE_NAME \
--zone=$ZONE \
--image-family=$IMAGE_FAMILY \
--image-project=mytestproject \
--maintenance-policy=TERMINATE \
--accelerator="type=ndivia-tesla-v100,count=8" \
--machine-type=$INSTANCE_TYPE \
--boot-disk-size=100GB \
--metadata="install-"install-ndivia-driver=True"
To list created virtual machines, use the command below:
gcloud compute instances list
To view the status of a specific instance, use the below command:
gcloud compute instances describe <INSTANCE_NAME>
That’s about the installation of Goolge Cloud SDK on Linux Mint 22 / Ubuntu 24.04 and some examples on how to use. I you already have a Google Cloud account, there is a lot you can benefit from using the SDK. I hope the few example will help you get started as you continue to explore the use of the SDK. Enjoy and don’t forget to check more interesting guides below:
- Backup Files to DigitalOcean Spaces using AWS CLI
- How to Provision Virtual Machines on AWS using Terraform
- How To Deploy VM Instance on Google Cloud using Terraform
- Provision VMs on Openstack with Terraform