$linuxjunkies
>

Install the gcloud SDK on Linux

Install the Google Cloud CLI on Linux via package repository or tarball, then configure authentication, optional components, and kubectl for GKE.

BeginnerUbuntuDebianFedoraArch8 min readUpdated June 7, 2026

Before you start

  • A Google Cloud account with at least one project created
  • curl and gpg installed (sudo apt install curl gpg on Debian/Ubuntu)
  • sudo access for system-wide (repository) installs, or a writable home directory for tarball installs
  • A modern 64-bit Linux system (x86_64 or ARM64)

The Google Cloud CLI (gcloud) is your primary interface to Google Cloud Platform from the terminal. You can install it two ways: from a Google-hosted package repository (easiest to keep updated) or from a standalone tarball (useful for restricted environments or pinning a version). This guide covers both, then walks through authentication, installing optional components, and adding kubectl support.

The package repository lets apt, dnf, or pacman handle updates alongside your normal system packages.

Debian / Ubuntu

Add Google's signing key and repository, then install the package.

sudo apt install -y curl gpg
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] \
https://packages.cloud.google.com/apt cloud-sdk main" \
  | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt update && sudo apt install -y google-cloud-cli

Fedora / RHEL / Rocky Linux

Google provides a .repo file you can drop straight into /etc/yum.repos.d/.

sudo tee /etc/yum.repos.d/google-cloud-sdk.repo <<'EOF'
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

Adjust el9 to el8 if you are on RHEL 8 / Rocky 8. Then install:

sudo dnf install -y google-cloud-cli

Arch Linux

The SDK is in the AUR. Use your preferred AUR helper:

paru -S google-cloud-cli
# or: yay -S google-cloud-cli

Method 2: Tarball Install

The tarball works on any distro and lets you install without root. It bundles its own Python interpreter so you are not tied to the system Python version.

Download and Extract

Always grab the latest version number from Google's versioned archives page. Replace the version below with the current one.

VERSION=477.0.0
ARCH=linux-x86_64   # use linux-arm for 64-bit ARM
curl -O "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${VERSION}-${ARCH}.tar.gz"
tar -xzf "google-cloud-cli-${VERSION}-${ARCH}.tar.gz" -C "$HOME"

Run the Installer Script

The bundled script adds gcloud to your shell's PATH and completion files.

"$HOME/google-cloud-sdk/install.sh" --quiet

Reload your shell to pick up the new PATH entry:

source "$HOME/.bashrc"
# zsh users: source "$HOME/.zshrc"

To upgrade later, run:

gcloud components update

Note: gcloud components update only works with tarball installs. Package-manager installs must update through the package manager; running components update there will print a warning and do nothing.

Authenticate with Google Cloud

Before you can use any GCP service, authenticate as yourself or as a service account.

Interactive Login (User Account)

This opens a browser window for OAuth. On a headless server, add --no-browser and follow the printed URL.

gcloud auth login

Set your default project so you don't have to pass --project on every command:

gcloud config set project YOUR_PROJECT_ID

Application Default Credentials (ADC)

Many client libraries and tools (Terraform, the GCS FUSE driver) look for ADC rather than user credentials. Generate them separately:

gcloud auth application-default login

Service Account Authentication

For CI/CD or server environments, activate a downloaded service account JSON key:

gcloud auth activate-service-account \
  --key-file=/path/to/service-account-key.json

Security note: Store key files outside your project tree and restrict permissions to 600. Prefer Workload Identity Federation over key files whenever your environment supports it.

Managing Components

The gcloud SDK uses a component system for optional tools. List what is available and installed:

gcloud components list

Output will show component IDs, names, sizes, and status (Installed / Not Installed). Install any component by ID:

gcloud components install COMPONENT_ID

Commonly useful components beyond the base CLI:

  • alpha — alpha-stage gcloud commands
  • beta — beta-stage gcloud commands
  • cloud-run-proxy — local proxy for Cloud Run services
  • gsutil — legacy Cloud Storage CLI (the modern replacement is gcloud storage)
  • gke-gcloud-auth-plugin — required for GKE authentication since Kubernetes 1.26 (see below)

Package-manager installs should install components as separate packages instead. For example, on Debian/Ubuntu:

sudo apt install -y google-cloud-cli-gke-gcloud-auth-plugin

Adding kubectl and GKE Support

The kubectl binary is not part of the gcloud SDK itself, but gcloud can install a matching version as a component. Separately, GKE clusters require the gke-gcloud-auth-plugin for kubectl to authenticate.

Install kubectl via gcloud (Tarball Install)

gcloud components install kubectl

Install kubectl via Package Manager (Debian/Ubuntu)

sudo apt install -y kubectl

Install the GKE Auth Plugin

Without this plugin, kubectl will fail to connect to GKE clusters on Kubernetes 1.26+.

# Tarball install:
gcloud components install gke-gcloud-auth-plugin

# Debian/Ubuntu package install:
sudo apt install -y google-cloud-cli-gke-gcloud-auth-plugin

# Fedora/RHEL:
sudo dnf install -y google-cloud-cli-gke-gcloud-auth-plugin

After installing the plugin, fetch credentials for a cluster and verify connectivity:

gcloud container clusters get-credentials CLUSTER_NAME \
  --region REGION --project YOUR_PROJECT_ID

kubectl get nodes

Verify the Installation

Confirm the CLI is reachable and authenticated:

gcloud version

You should see output listing the Cloud SDK version and component versions. Then check your active account and project:

gcloud auth list
gcloud config list

Run a lightweight API call to confirm end-to-end connectivity:

gcloud projects describe YOUR_PROJECT_ID

Troubleshooting

  • gcloud: command not found — Your PATH hasn't been updated. For tarball installs, run source ~/.bashrc (or ~/.zshrc). For package installs, confirm /usr/bin/gcloud exists with which gcloud.
  • Browser won't open during gcloud auth login — Add the --no-browser flag. gcloud will print a URL you can open on another machine and paste the resulting code back into the terminal.
  • GPG / apt key errors on Ubuntu — Ensure you used --dearmor and wrote the keyring to /usr/share/keyrings/, not the deprecated /etc/apt/trusted.gpg.d/ path.
  • kubectl fails with "Please run gcloud components install gke-gcloud-auth-plugin" — Install the plugin as shown above and re-run gcloud container clusters get-credentials.
  • Proxy environments — Set HTTPS_PROXY and HTTP_PROXY environment variables before running any gcloud commands, or configure them in gcloud config set proxy/*.
tested on:Ubuntu 24.04Debian 12Fedora 40Arch rolling

Frequently asked questions

What is the difference between gcloud auth login and gcloud auth application-default login?
gcloud auth login authenticates the gcloud CLI itself. gcloud auth application-default login creates credentials that client libraries (and tools like Terraform) use when calling GCP APIs on your behalf. You often need both.
Can I install the gcloud SDK without root access?
Yes. Use the tarball method and extract it to a directory in your home folder. The install.sh script updates your personal shell RC file and does not require sudo.
How do I update the gcloud SDK?
For tarball installs, run gcloud components update. For package-manager installs, update through apt, dnf, or pacman as you would any other package — gcloud components update will not work in that case.
Why does kubectl fail to connect to my GKE cluster after upgrading Kubernetes?
Kubernetes 1.26 removed the built-in GCP authentication. You must install the gke-gcloud-auth-plugin component and re-run gcloud container clusters get-credentials to refresh your kubeconfig.
Is it safe to store service account key files on disk?
It is a security risk if not handled carefully. Restrict permissions to 600, store the file outside version-controlled directories, and prefer Workload Identity Federation where your environment supports it to avoid long-lived key files entirely.

Related guides