Install the Google Cloud CLI
This quickstart describes the recommended method to install and initialize the Google Cloud CLI. After initialization, run a few core gcloud CLI commands to view information about your installation and verify it was successful.
To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Install gcloud CLI version 581.0.0
Linux
- Confirm that you have a supported version of Python. The Google Cloud CLI requires
Python 3.10 to 3.14. The x86_64 Linux package includes
a bundled Python interpreter that will be preferred by default. For
information on how to choose and configure your Python interpreter, see the
gcloud topic startupdocumentation. - Download one of the following:
Note: To determine your Linux platform, run
uname -aat the command line.Platform Package name Size SHA256 Checksum Linux 64-bit (x86_64)
google-cloud-cli-linux-x86_64.tar.gz 96.6 MB 42e4b1a6a687ee96ae3919f2917d854f1d4b97f0c62581b6568728f83fd378a7 Linux 64-bit (Arm)
google-cloud-cli-linux-arm.tar.gz 62.1 MB caed087877643852ddbe9f7eedba5057431006971a9f0970cffc247f86eef09c Linux 32-bit (x86)
google-cloud-cli-linux-x86.tar.gz 62.1 MB a95e21de373341cce14edb3d29913ef99fad6a3fa5179d989ff13114aaab1494 To download the Linux archive file, run the following command:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
Refer to the table above and replace google-cloud-cli-linux-x86_64.tar.gz with the
*.tar.gzpackage name that applies to your configuration. - To extract the contents of the file to your file system, run the following command:
tar -xf google-cloud-cli-linux-x86_64.tar.gz
To replace an existing installation, delete the existinggoogle-cloud-sdkdirectory and then extract the archive to the same location. - Run the installation script from the root of the folder you
extracted:
./google-cloud-sdk/install.sh
The script prompts you to perform the following setup actions. To accept, answerYwhen prompted.- Add the gcloud CLI to your
PATH. - Enable command completion.
- Opt in to send anonymous usage statistics to help improve the gcloud CLI.
./google-cloud-sdk/install.sh --help - Add the gcloud CLI to your
- Optional: If you updated your
PATHin the previous step, open a new terminal so that the changes take effect.
Package contents
The gcloud CLI is available in package format for installation on Debian and Ubuntu
systems. This package contains the gcloud, gcloud alpha,
gcloud beta, gsutil, and bq command-line tools only. It
doesn't include kubectl or the App Engine extensions required to deploy an
application using gcloud commands. If you want these components, you must
install them separately.
- If you're running a modern Ubuntu release with Snap Package Manager and want automatic updates, you can install Google Cloud CLI as a snap package.
- If you're using a Compute Engine instance, the gcloud CLI might already be installed. For a list of operating system images that include the CLI by default, see OS details.
Before you begin
Before you install the gcloud CLI, make sure that your operating system meets the following requirements:
- It is an Ubuntu release that hasn't reached end-of-life or a Debian stable release that hasn't reached end-of-life.
- It has recently updated its packages. To do this now, run the following command:
sudo apt-get update
- It has
ca-certificates,gnupg, andcurlinstalled. To install these packages, run the following command:sudo apt-get install ca-certificates gnupg curl
Installation
- Import the Google Cloud public key.
For newer distributions (Debian 9+ or Ubuntu 18.04+) run the following command:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
- For older distributions, run the following command:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
If your distribution's apt-key command doesn't support the
--keyringargument, run the following command:curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
If you can't get latest updates due to an expired key, obtain the latest apt-get.gpg key file.
- Add the gcloud CLI distribution URI as a package source.
- For newer distributions (Debian 9+ or Ubuntu 18.04+), run the following command:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
For older distributions that don't support the signed-by option, run the following command:
echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
cloud-sdkrepo in/etc/apt/sources.list.d/google-cloud-sdk.list. - For newer distributions (Debian 9+ or Ubuntu 18.04+), run the following command:
- Update and install the gcloud CLI:
sudo apt-get update && sudo apt-get install google-cloud-cli
Note: If installing in resource-constrained virtual machines, container images, or automated CI/CD runners, you can export the environment variableCLOUDSDK_SKIP_PY_COMPILATION=1during installation to skip host-side Python compilation. This drops package installation time from minutes down to seconds:sudo CLOUDSDK_SKIP_PY_COMPILATION=1 apt-get install google-cloud-cli
Setting this variable skips byte-compilation on installation, trading some package setup speed for minor interactive command execution overhead. For additionalapt-getoptions, such as disabling prompts or dry runs, refer to theapt-getman pages.Docker Tip: If installing the gcloud CLI inside a Docker image, use a single RUN step instead:
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && apt-get update -y && apt-get install google-cloud-cli -y
For older base images that do not support thegpg --dearmorcommand:RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-cli -y
- Optional: Install any of the following
additional components:
google-cloud-cli-anthos-authgoogle-cloud-cli-app-engine-gogoogle-cloud-cli-app-engine-grpcgoogle-cloud-cli-app-engine-javagoogle-cloud-cli-app-engine-pythongoogle-cloud-cli-app-engine-python-extrasgoogle-cloud-cli-bigtable-emulatorgoogle-cloud-cli-cbtgoogle-cloud-cli-cloud-build-localgoogle-cloud-cli-cloud-run-proxygoogle-cloud-cli-config-connectorgoogle-cloud-cli-datastore-emulatorgoogle-cloud-cli-firestore-emulatorgoogle-cloud-cli-gke-gcloud-auth-plugingoogle-cloud-cli-kptgoogle-cloud-cli-kubectl-oidcgoogle-cloud-cli-local-extractgoogle-cloud-cli-minikubegoogle-cloud-cli-nomosgoogle-cloud-cli-pubsub-emulatorgoogle-cloud-cli-skaffoldgoogle-cloud-cli-spanner-emulatorgoogle-cloud-cli-terraform-toolsgoogle-cloud-cli-testskubectl
For example, the
google-cloud-cli-app-engine-javacomponent can be installed as follows:sudo apt-get install google-cloud-cli-app-engine-java
Downgrade gcloud CLI versions
To revert to a specific version of the gcloud CLI, where VERSION is of the
form 123.0.0, run the following command:
sudo apt-get update && sudo apt-get install google-cloud-cli=123.0.0-0
The ten most recent releases are always available in the repo. For releases prior to 371.0.0, the package name is google-cloud-sdk.
Package contents
The gcloud CLI is available in package format for installation on
Red Hat Enterprise Linux 7, 8, 9, and 10; Fedora 41 and 42; and CentOS 7 and 8 systems.
This package contains the
gcloud, gcloud alpha, gcloud beta, gsutil, and
bq commands only. It doesn't include kubectl or the App Engine
extensions required to deploy an application using gcloud commands, which can be
installed separately as described later in this section.
Installation
- Update DNF with gcloud CLI repository information.
-
The following sample command is for a Red Hat Enterprise Linux 7, 8, or 9-compatible installations, but make sure that you update the settings as needed for your configuration:
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo
Web Proxy Viewer | New URL | Original Page
-