Reading time: | 5 min |
Last updated: | 5 Feb 2025 |
Test status: |
Reading time: |
5 min |
Last updated: |
5 Feb 2025 |
Test status: |
This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.
The Google Cloud CLI, gcloud
, allows you to run commands in your Google Cloud account.
gcloud
is available for Windows, macOS, Linux and supports the Arm architecture.
Use the documentation link to find alternative installation options.
This article provides a quick solution to install gcloud
for Ubuntu on Arm.
Confirm you are using an Arm machine by running:
uname -m
The output should be:
aarch64
If you see a different result, you are not using an Arm computer running 64-bit Linux.
The easiest way to install gcloud
for Ubuntu on Arm is to use the package manager.
Download and install the required software packages.
sudo apt-get install -y curl apt-transport-https ca-certificates gnupg
Install gcloud
from the Google repository.
echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-cloud-cli -y
If you cannot use the package manager or you get a Python version error such as the one below you can use the archive file.
The following packages have unmet dependencies:
google-cloud-cli : Depends: python3 (< 3.12) but 3.12.3-0ubuntu2 is to be installed
Download the archive file and extract the contents:
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-arm.tar.gz
sudo tar -xzf google-cloud-cli-linux-arm.tar.gz -C /opt
Run the installer:
cd /opt/google-cloud-sdk
sudo ./install.sh -q
You can change the installation directory from /opt
to a location of your choice.
Add the installation directory to your search path. The installer will print the path to a script you can source to add gcloud
to your search path.
==> Source [/opt/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/opt/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.
For more information on how to get started, please visit:
https://cloud.google.com/sdk/docs/quickstarts
Source the file to include gcloud
in your search path:
source /opt/google-cloud-sdk/path.bash.inc
Alternatively, you can add the bin
directory to your path by adding the line below to your $HOME/.bashrc
file.
export PATH="/opt/google-cloud-sdk/bin:$PATH"
Confirm the executable is available and print the version:
gcloud -v
The output is similar to:
Google Cloud SDK 418.0.0
alpha 2023.02.13
beta 2023.02.13
bq 2.0.85
bundled-python3-unix 3.9.16
core 2023.02.13
gcloud-crc32c 1.0.0
gsutil 5.20
You can use gcloud
to obtain user access credentials for Google Cloud using a web flow. You will put the credentials in a well-known location for Application Default Credentials (ADC
).
Run the following command to obtain user access credentials:
gcloud auth application-default login
The command outputs a uniquely generated URL and a prompt to enter an authorization code, as shown below:
Open the URL in your browser and copy the unique authentication code.
Now, paste the authentication code as shown below. The following output indicates a successful log in:
Enter authorization code: 4/0AfgeXvsdW0jpvy3dBg5SH03DryspZyV5nz0j3lIDg4LwjL1AgikjjJYHgWlcap3Xtb0ioA
Credentials saved to file: [/home/ubuntu/.config/gcloud/application_default_credentials.json]
These credentials will be used by any library that requests Application Default Credentials (ADC).
After a successful log in, you will be able to use the Google Cloud CLI
and automation tools like
Terraform
from the terminal.
How would you rate the overall quality of this tool quick-install guide?
What is the primary reason for your feedback ?
Thank you. We're grateful for your feedback on how to improve this tool quick-install guide.