How to Install Google Cloud CLI on Ubuntu (26.04, 24.04, 22.04)

Last updated Friday, March 13, 2026 6:37 pm 9 min read

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, you add Google’s APT repository, install the google-cloud-cli package, and then 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. The base package installs gcloud, gcloud alpha, gcloud beta, gsutil, and bq, while kubectl and the App Engine extras stay separate. Google also publishes an official classic snap if automatic refreshes matter more than keeping optional packages inside the same APT workflow.

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.

These steps work on Ubuntu 26.04, 24.04, and 22.04 because Google’s repository uses the generic cloud-sdk suite instead of Ubuntu-specific codenames. On Ubuntu 26.04, current gcloud commands print two readlink warnings before the normal output, but the CLI still works.

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-get update && sudo apt-get upgrade -y

These commands use sudo for 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-get install ca-certificates curl gnupg -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 -o /usr/share/keyrings/google-cloud-cli.gpg

This uses the curl command in Linux to download the ASCII-armored key and gpg --dearmor to convert it into the binary format APT expects in /usr/share/keyrings/.

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

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-get update
Get:4 https://packages.cloud.google.com/apt cloud-sdk InRelease [1,620 B]
Get:5 https://packages.cloud.google.com/apt cloud-sdk/main all Packages [1,958 kB]
Get:6 https://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages [4,563 kB]

Check the candidate version before you install the package.

apt-cache policy google-cloud-cli
google-cloud-cli:
  Installed: (none)
  Candidate: 560.0.0-0
  Version table:
     560.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-get 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

Ubuntu 26.04 currently prints two readlink warnings before the version block. Ubuntu 24.04 and 22.04 show the same version data without those extra lines.

readlink: /usr/bin/../lib/google-cloud-sdk/bin/gcloud: Invalid argument
readlink: /usr/bin/../lib/google-cloud-sdk/bin: Invalid argument
Google Cloud SDK 560.0.0
alpha 2026.03.09
beta 2026.03.09
bq 2.1.29
bundled-python3-unix 3.13.10
core 2026.03.09
gcloud-crc32c 1.0.0
gsutil 5.36

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.

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 properties are already set.

gcloud config list
Your active configuration is: [default]
[core]
disable_usage_reporting = True

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
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]

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, and GKE helper packages.

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

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-get install kubectl google-cloud-cli-gke-gcloud-auth-plugin -y

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-get update && sudo apt-get 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 understanding the extra wrapper warnings that appear on Ubuntu 26.04.

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-get update

Confirm the old file is gone before you continue.

ls /etc/apt/sources.list.d | grep "google-cloud-sdk" || echo removed
removed

Understand readlink Warnings on Ubuntu 26.04

Ubuntu 26.04 currently prints two readlink warnings before normal gcloud output because the wrapper script still expects GNU readlink behavior.

readlink: /usr/bin/../lib/google-cloud-sdk/bin/gcloud: Invalid argument
readlink: /usr/bin/../lib/google-cloud-sdk/bin: Invalid argument

The CLI still returns the correct data afterward, so interactive use is fine. For scripts that parse stderr, Ubuntu 24.04 and 22.04 are cleaner choices until Google updates the wrapper. If you are not sure which release this system is running, check it first with our guide on how to check Ubuntu version.

Remove Google Cloud CLI on Ubuntu

Removing Google Cloud CLI cleanly means purging 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

Purge the package first, then let APT remove dependencies that were installed only for this CLI.

sudo apt-get purge google-cloud-cli -y
sudo apt-get autoremove -y

Verify that Ubuntu no longer considers the package installed.

apt-cache policy google-cloud-cli
google-cloud-cli:
  Installed: (none)
  Candidate: 560.0.0-0
  Version table:
     560.0.0-0 500
        500 https://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages

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.

sudo rm -f /etc/apt/sources.list.d/google-cloud-cli.sources
sudo rm -f /usr/share/keyrings/google-cloud-cli.gpg
sudo apt-get update

Confirm that the repository file is gone.

ls /etc/apt/sources.list.d | grep "google-cloud-cli" || echo removed
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

Google Cloud CLI on Ubuntu FAQ

Should I use the Google Cloud CLI APT repository or the snap on Ubuntu?

Use the APT repository if you want the base CLI and optional packages such as kubectl or google-cloud-cli-gke-gcloud-auth-plugin to stay in one package-management workflow. Use the official classic snap when automatic refreshes matter more than managing every add-on through APT.

Can I use Google Cloud CLI on a headless Ubuntu server?

Yes. The same APT package works on Ubuntu servers and minimal images as long as you install the prerequisite packages first. After that, initialize it with gcloud init --console-only so the sign-in flow stays in your SSH session instead of trying to open a local browser.

Does the Ubuntu Google Cloud CLI package include kubectl?

No. The base package includes gcloud, gcloud alpha, gcloud beta, gsutil, and bq, but kubectl and the App Engine extras stay separate. Install those packages afterward from the same Google repository when you need them.

Why do I get a Signed-By conflict when I update APT?

That happens when an older google-cloud-sdk.list file and the newer google-cloud-cli.sources file both point to the same repository. Remove the legacy list file, keep the DEB822 .sources file, and run sudo apt-get update again.

Why does Google Cloud CLI print readlink warnings on Ubuntu 26.04?

Current Google Cloud CLI wrapper scripts still expect GNU readlink behavior, so Ubuntu 26.04 prints two warning lines before the normal command output. The CLI still works interactively, but if you need clean stderr for automation, Ubuntu 24.04 or 22.04 are cleaner choices until Google updates the wrapper.

Conclusion

Google Cloud CLI is installed on Ubuntu and ready for browser-based or console-only sign-in. If you manage this system remotely, use our guide to install SSH on Ubuntu, and keep the base system current with our guide to update Ubuntu packages from the command line.

Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: