How to Install Google Cloud CLI on Ubuntu 26.04 and 24.04

Share

To install Google Cloud CLI on Ubuntu, add Google’s official APT repository and install the google-cloud-cli package.

If you used Google Cloud SDK before, the command is still gcloud. Choose APT for this walkthrough or use Snap if you already use it and want automatic updates.

Before you begin
  1. Release and architecture. Use Ubuntu 26.04 LTS, 24.04 LTS, or 26.10 on an amd64 or arm64 system.
  2. Terminal and administrator access. You need internet access and a user who can run sudo for APT or Snap.
  3. Google Cloud access for setup. Have a Google account and the ID of a project you can access. You can install and check the CLI before signing in.

Step 1. Check your system and prepare APT

Check your Ubuntu release, package architecture, and any existing copy of the CLI.

Ubuntu terminal
. /etc/os-release
printf '%s\n' "$PRETTY_NAME"
dpkg --print-architecture
command -v gcloud

Continue if the architecture is amd64 or arm64. If the last command prints a path, check how that copy was installed before adding another one.

Ubuntu terminal
sudo apt update && sudo apt install ca-certificates curl gnupg

Step 2. Add Google’s signing key and repository

Check for an existing Google Cloud CLI source. If a line appears, inspect the listed file. Keep one active entry for this repository. If the entry already works, skip to Step 3.

Ubuntu terminal
grep -nH 'packages.cloud.google.com/apt' /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources 2>/dev/null

For a fresh setup, download the key, make it readable to APT, and write a dedicated source file. The key is scoped to this repository. If google-cloud-cli.list already exists, inspect it first because the command replaces that file.

Ubuntu terminal
(
  set -e
  key_dir=$(mktemp -d)
  trap 'rm -f -- "$key_dir/key.gpg" "$key_dir/cloud.google.gpg"; rmdir -- "$key_dir"' EXIT
  curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg -o "$key_dir/key.gpg"
  gpg --batch --dearmor -o "$key_dir/cloud.google.gpg" "$key_dir/key.gpg"
  sudo install -m 0644 "$key_dir/cloud.google.gpg" /usr/share/keyrings/cloud.google.gpg
  sudo tee /etc/apt/sources.list.d/google-cloud-cli.list >/dev/null <<'EOF'
deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
EOF
)

The suite is cloud-sdk on all three Ubuntu releases. Keep that literal value in the source line.

Step 3. Install and verify Google Cloud CLI

Refresh APT and check that Google’s repository offers an install candidate.

Ubuntu terminal
sudo apt update && apt-cache policy google-cloud-cli

The policy output should show a candidate version and the Google package server. If the update reports a Google repository error, fix it before continuing.

Ubuntu terminal
sudo apt install google-cloud-cli && gcloud version

The version output starts with Google Cloud SDK. That label also appears in current Google Cloud CLI builds.

Step 4. Sign in and confirm your project

Run the following as your regular user. Sign in in the browser, then select a project you can access. The CLI stores the selected account and project in your local configuration.

Ubuntu terminal
gcloud init

On a machine without a browser, run gcloud init --no-launch-browser and follow the prompts using a trusted device with a browser. Keep sign-in codes private.

Check the project before running commands that can change resources or incur charges.

Ubuntu terminal
gcloud config get-value project

The command prints the project ID. If it shows an unset value or the wrong project, run the setup again and choose the intended project.

Install Google Cloud CLI with Snap

Use Snap if you want automatic updates

Use this option in place of the APT install steps. Snap needs snapd and classic confinement, which gives the tool access to your system files with your user permissions.

If snap list google-cloud-sdk shows the deprecated Snap, remove it with sudo snap remove google-cloud-sdk before installing the current Snap. The two packages use the same command aliases.

Ubuntu terminal
sudo snap install google-cloud-cli --classic && gcloud version

After installing, follow Step 4 to sign in. For a per-user install without sudo, see Google’s versioned Linux archives and choose the file and checksum for your architecture.

Troubleshoot Google Cloud CLI on Ubuntu

APT reports a signing error or duplicate source

Check that the source’s signed-by path matches the keyring created in Step 2. If APT reports conflicting Signed-By values, inspect the files listed in Step 2 and disable the stale entry. Then update APT and check for a candidate again.

The shell finds a different gcloud install

Compare command -v gcloud with the method you installed. If an older archive or Snap comes first on your shell’s PATH, remove it using its original install method or adjust PATH. Open a new terminal and check again.

Update or remove Google Cloud CLI

APT package

Update the installed package with APT. Use APT for additional components such as the separately packaged GKE authentication plugin.

Ubuntu terminal
sudo apt update && sudo apt install --only-upgrade google-cloud-cli

To uninstall the CLI, run the removal command below. If you added the Google repository only for this CLI and its components, you can also remove the dedicated source file. Keep the source if other packages still use it.

Ubuntu terminal
sudo apt remove google-cloud-cli
Snap package

Snap refreshes automatically. To check for an update now, run sudo snap refresh google-cloud-cli. To uninstall the Snap, run:

Ubuntu terminal
sudo snap remove google-cloud-cli

Uninstalling the package and removing saved accounts are separate actions. If you still have the CLI installed and want to remove its local authorization, revoke that account before uninstalling. Review your saved configurations before deleting anything.

Google Cloud CLI FAQ

Is Google Cloud CLI the same tool as Google Cloud SDK?

Google Cloud CLI is the current name for the command-line tool distributed as Google Cloud SDK. Install google-cloud-cli and run it with the gcloud command.

Can I install Google Cloud CLI on Ubuntu without signing in?

Yes. Install the package and run gcloud version without a Google account. Sign in when you need the CLI to access your Google Cloud projects.

Does gcloud init set up credentials for client libraries?

gcloud init sets up the CLI’s account and configuration. For local development with Google Cloud client libraries, set up Application Default Credentials separately when your project calls for them.

Helpful Resources

r/googlecloud Ask the community about Google Cloud and gcloud.
Google Cloud CLI installation guide Find Google’s packages and supported install paths.
gcloud init command reference Look up setup options for local terminals and SSH.
Google Cloud CLI components Find optional tools and their package names.