Compute Engine instances, Cloud Storage buckets, and IAM settings are easier to manage when the whole Google Cloud workflow stays in your Ubuntu terminal. To install Google Cloud CLI on Ubuntu Linux, add Google’s APT repository, install the google-cloud-cli package, and initialize gcloud for either a desktop browser session or a headless server login.
Ubuntu’s default repositories do not ship the current google-cloud-cli package, so Google’s APT repository is the practical install path. Older tutorials may still call the tool Google Cloud SDK, but the current Debian/Ubuntu package is google-cloud-cli and the command you run afterward is gcloud. The base package also installs gsutil and bq, while kubectl and App Engine extras stay separate.
Install Google Cloud CLI on Ubuntu
Google’s official APT repository is the cleanest Ubuntu install path because it keeps the CLI, later upgrades, and optional add-on packages in one place. If you searched for apt install gcloud, use the package name google-cloud-cli instead; APT installs that package and then exposes the gcloud command.
Google’s install docs also list a classic Snap package for Google Cloud CLI if you prefer Snap’s automatic refresh model. The APT workflow is a better fit when you want optional packages such as kubectl or google-cloud-cli-gke-gcloud-auth-plugin from the same Google repository.
These steps work on Ubuntu 26.04, 24.04, and 22.04 because Google’s repository uses the generic
cloud-sdksuite instead of Ubuntu-specific codenames. If you are using Google Cloud Shell in a browser,gcloudis already available there; use this Ubuntu install flow for systems you manage yourself.
Update Ubuntu Before Installing Google Cloud CLI
Refresh the package lists and install any pending system updates before you add Google’s repository.
sudo apt update && sudo apt upgrade -y
These commands use
sudofor tasks that need root privileges. If your account does not have sudo access yet, follow our guide on how to add a new user to sudoers on Ubuntu.
Install Google Cloud CLI Prerequisite Packages on Ubuntu
Install the packages needed for HTTPS downloads and keyring handling.
sudo apt install ca-certificates curl gpg -y
Desktop Ubuntu installs often already have these packages, but cloud images and minimal server builds often do not.
Import the Google Cloud CLI Signing Key
Import Google’s public key so APT can verify the repository metadata and package signatures.
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/google-cloud-cli.gpg
This uses the curl command in Linux to download the ASCII-armored key and gpg --dearmor --yes to convert it into the binary format APT expects in /usr/share/keyrings/. The --yes flag keeps reruns from stopping at an overwrite prompt.
Add the Google Cloud CLI Repository on Ubuntu
Write the repository definition as a DEB822 .sources file so the key path stays attached to the source configuration.
printf '%s\n' \
'Types: deb' \
'URIs: https://packages.cloud.google.com/apt' \
'Suites: cloud-sdk' \
'Components: main' \
"Architectures: $(dpkg --print-architecture)" \
'Signed-By: /usr/share/keyrings/google-cloud-cli.gpg' \
| sudo tee /etc/apt/sources.list.d/google-cloud-cli.sources > /dev/null
The printf | sudo tee pattern writes the file as root without relying on shell redirection, and $(dpkg --print-architecture) inserts your current package architecture automatically when you paste the command.
cat /etc/apt/sources.list.d/google-cloud-cli.sources
Types: deb URIs: https://packages.cloud.google.com/apt Suites: cloud-sdk Components: main Architectures: amd64 Signed-By: /usr/share/keyrings/google-cloud-cli.gpg
On ARM64 systems, the Architectures: line prints arm64 instead of amd64. Google’s current repository metadata publishes both architectures for google-cloud-cli.
Verify the Google Cloud CLI Repository on Ubuntu
Refresh APT so Ubuntu reads the new source file and downloads the Google package indexes.
sudo apt update
Check the candidate version before you install the package. A newer candidate is fine; the relevant output should show Google’s cloud-sdk source for google-cloud-cli.
apt-cache policy google-cloud-cli
google-cloud-cli:
Installed: (none)
Candidate: 567.0.0-0
Version table:
567.0.0-0 500
500 https://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages
The package name is google-cloud-cli, but the executable you run afterward is gcloud.
Install Google Cloud CLI with APT
Install the base package once the repository and candidate version both look correct.
sudo apt install google-cloud-cli -y
Verify Google Cloud CLI Installation on Ubuntu
Run the version command to confirm that gcloud, gsutil, and the bundled helper tools are ready.
gcloud version
Version numbers change as Google publishes new releases, but the first line should show Google Cloud SDK followed by the installed release.
Google Cloud SDK 567.0.0 alpha 2026.05.01 beta 2026.05.01 bq 2.1.31 bundled-python3-unix 3.13.11 core 2026.05.01 gcloud-crc32c 1.0.0 gsutil 5.37 preview 2026.05.01
Initialize Google Cloud CLI on Ubuntu
The package is installed at this point, but you still need to initialize gcloud and choose how this Ubuntu system should authenticate.
Initialize Google Cloud CLI on Ubuntu Desktop
Use the default workflow if this Ubuntu system has a local browser session available.
gcloud init
The command opens your browser, asks you to sign in, lets you pick a project, and then writes the default configuration under your home directory.
Initialize Google Cloud CLI on Headless Ubuntu Servers
Use the console-only flow when you are connected over SSH or managing a server without a local desktop session.
gcloud init --console-only
This keeps the setup in the terminal and prints the authorization URL instead of trying to launch a local browser. If this machine is remote, make sure you already know how to install SSH on Ubuntu before you depend on the console-only workflow.
Use Google Cloud Shell Without an Ubuntu Install
Google Cloud Shell already includes Google Cloud CLI, so you do not need to add the Ubuntu APT repository inside the browser-based shell. Cloud Shell allows sudo apt install for temporary VM packages, but those packages do not persist after the instance terminates unless you install them under $HOME or configure a custom Cloud Shell environment.
For the persistence details, see Google’s Cloud Shell behavior documentation. Use the Ubuntu commands in this article for your own Ubuntu workstation, server, or VM.
Check Google Cloud CLI Authentication on Ubuntu
Check the current login state before or after initialization.
gcloud auth list
No credentialed accounts. To login, run: $ gcloud auth login `ACCOUNT`
After you sign in, this command lists the active account instead of the no-credentials message.
Review the Active Google Cloud CLI Configuration on Ubuntu
Inspect the local configuration after initialization so you know which profile is active and which account or project properties are already set. The output depends on your sign-in choices, so treat it as a local state check rather than a fixed expected-output block.
gcloud config list
Learn Google Cloud CLI Basics on Ubuntu
Once gcloud is installed, the safest next step is learning how to discover commands and optional packages before you change resources in a live project.
Browse Google Cloud CLI Help on Ubuntu
Start with the main help page to see how Google organizes command groups, flags, and configuration options.
gcloud help
Relevant output begins with:
NAME
gcloud - manage Google Cloud resources and developer workflow
SYNOPSIS
gcloud GROUP | COMMAND [--account=ACCOUNT]
[--billing-project=BILLING_PROJECT] [--configuration=CONFIGURATION]
[--flags-file=YAML_FILE] [--flatten=[KEY,...]] [--format=FORMAT]
[--help] [--project=PROJECT_ID] [--quiet, -q]
[--verbosity=VERBOSITY; default="warning"] [--version, -v] [-h]
[--access-token-file=ACCESS_TOKEN_FILE]
Google’s gcloud CLI overview, full gcloud CLI reference, and gcloud CLI cheat sheet are useful once you move beyond first-run commands.
A practical next sequence is gcloud auth login on desktop Ubuntu or gcloud init --console-only on a headless server, followed by gcloud projects list to see what you can access and gcloud config set project PROJECT_ID to lock the CLI to the project you plan to manage.
Check Optional Google Cloud CLI Packages on Ubuntu
Google publishes extra APT packages for tools the base install leaves out, including App Engine runtimes, emulators, Anthos tools, and GKE helper packages. If you only searched for gsutil, the base google-cloud-cli package already installs it.
apt-cache search '^google-cloud-cli-' | sed -n '1,12p'
google-cloud-cli-anthos-auth - anthos-auth google-cloud-cli-anthoscli - anthoscli google-cloud-cli-app-engine-go - Go runtime for Google App Engine google-cloud-cli-app-engine-grpc - Provides the gRPC python library for app engine. google-cloud-cli-bigtable-emulator - Emulator for Google Cloud Bigtable. google-cloud-cli-cbt - Google Cloud Bigtable Command Line Tool google-cloud-cli-cloud-build-local - Google Cloud Build Local Builder google-cloud-cli-cloud-run-proxy - Cloud Run Proxy google-cloud-cli-config-connector - Google Cloud Config Connector google-cloud-cli-docker-credential-gcr - docker-credential-gcr google-cloud-cli-enterprise-certificate-proxy - enterprise-certificate-proxy google-cloud-cli-gke-gcloud-auth-plugin - gke-gcloud-auth-plugin
The current package list includes google-cloud-cli-anthoscli for Anthos tooling. When you know which extras you need, install them from the same repository. For example, this adds kubectl and the GKE auth plugin:
sudo apt install kubectl google-cloud-cli-gke-gcloud-auth-plugin -y
The GKE auth plugin package fixes Kubernetes authentication errors such as exec: executable gke-gcloud-auth-plugin not found after a kubeconfig switches to the newer plugin-based login flow.
Google’s Debian and Ubuntu install page keeps the current optional package list together with the base install instructions.
Update Google Cloud CLI on Ubuntu
Once the repository is configured, update Google Cloud CLI the same way you would update any other Ubuntu package from a third-party APT source.
Update Google Cloud CLI with APT
Refresh the package lists and upgrade only the Google Cloud CLI package instead of pulling unrelated packages forward.
sudo apt update && sudo apt install --only-upgrade google-cloud-cli
After the upgrade finishes, rerun gcloud version to confirm the newer release is active.
Troubleshoot Google Cloud CLI on Ubuntu
The most useful Ubuntu-specific checks are fixing duplicate repository files and confirming that APT is using Google’s current cloud-sdk source.
Fix Duplicate Google Cloud CLI Source Files on Ubuntu
If you previously used Google’s older google-cloud-sdk.list instructions and then switched to the DEB822 .sources file used here, APT rejects the duplicate source because the legacy file has no matching Signed-By value.
E: Conflicting values set for option Signed-By regarding source https://packages.cloud.google.com/apt/ cloud-sdk: /usr/share/keyrings/google-cloud-cli.gpg != E: The list of sources could not be read.
Remove the legacy list file, then refresh APT again.
sudo rm -f /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt update
Confirm the old file is gone before you continue.
ls /etc/apt/sources.list.d | grep "google-cloud-sdk" || echo removed
removed
Remove Google Cloud CLI on Ubuntu
Removing Google Cloud CLI cleanly means removing the package, deleting the repository and keyring, and deciding whether to keep or remove the local configuration stored under your home directory.
Remove the Google Cloud CLI Package on Ubuntu
Remove the package first. The current Google APT package does not register conffiles under /etc, so apt remove is the cleaner default than a forced purge.
sudo apt remove google-cloud-cli -y
Verify that Ubuntu no longer considers the package installed.
dpkg -l google-cloud-cli 2>/dev/null | grep '^ii' || echo "google-cloud-cli not installed"
google-cloud-cli not installed
Preview dependency cleanup separately before you remove anything else from the system.
sudo apt autoremove --dry-run
The preview can include packages unrelated to Google Cloud CLI if earlier removals left them orphaned. If you recognize every package and no longer need them, run the real cleanup:
sudo apt autoremove
Remove the Google Cloud CLI Repository and Key on Ubuntu
Delete the source file and keyring if you do not plan to reinstall the CLI. The command also removes older google-cloud-sdk.list and cloud.google.gpg leftovers when they exist, which prevents duplicate-source conflicts from older Google Cloud SDK instructions.
sudo rm -f /etc/apt/sources.list.d/google-cloud-cli.sources
sudo rm -f /etc/apt/sources.list.d/google-cloud-sdk.list
sudo rm -f /usr/share/keyrings/google-cloud-cli.gpg
sudo rm -f /usr/share/keyrings/cloud.google.gpg
sudo apt update
Confirm that the repository file is gone.
ls /etc/apt/sources.list.d | grep -E "google-cloud-(cli|sdk)" || echo removed
removed
Confirm Google’s source no longer appears as a package candidate.
apt-cache policy google-cloud-cli 2>/dev/null | grep packages.cloud.google.com || echo "Google Cloud CLI APT source removed"
Google Cloud CLI APT source removed
Remove Local Google Cloud CLI Data on Ubuntu
Google Cloud CLI stores your local configuration, logs, and credentials in ~/.config/gcloud.
The next command permanently deletes your local Google Cloud CLI profiles, cached tokens, logs, and default project settings. It does not remove projects, instances, buckets, IAM policies, or any other resources in Google Cloud itself.
rm -rf ~/.config/gcloud
Verify that the local data directory is gone.
test -d ~/.config/gcloud && echo present || echo absent
absent
Conclusion
Google Cloud CLI is installed on Ubuntu and ready for browser-based or console-only sign-in. Before using it against production resources, confirm the active project with gcloud config list and keep the base system current with our guide to update Ubuntu packages from the command line.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><a href="https://example.com">link</a><blockquote>quote</blockquote>