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
(x86_64) (Arm) (x86) To download the Linux archive file, run the following command:
Refer to the table above and replace google-cloud-cli-linux-x86_64.tar.gz with the
Package contents
The gcloud CLI is available in package format for installation on Debian and Ubuntu
systems. This package contains the Before you begin Before you install the gcloud CLI, make sure that your operating system meets the
following requirements: Installation For newer distributions (Debian 9+ or Ubuntu 18.04+) run the
following command: If your distribution's apt-key command doesn't support the If you can't get latest updates due to an expired key,
obtain the latest
apt-get.gpg key file. For older distributions that don't support the signed-by option, run the following command: Docker Tip: If installing the gcloud CLI inside a Docker image, use a
single RUN step instead:
For example, the Downgrade gcloud CLI versions
To revert to a specific version of the gcloud CLI, where The ten most recent releases are always available in the repo. For releases prior to 371.0.0, the package name is 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
Installation 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: For RHEL 10-compatible installations, use the following command with the updated
For ARM64 (aarch64) installations, use
gcloud topic startup documentation.
Platform
Package name
Size
SHA256 Checksum
Linux 64-bit
google-cloud-cli-linux-x86_64.tar.gz
96.6 MB
42e4b1a6a687ee96ae3919f2917d854f1d4b97f0c62581b6568728f83fd378a7
Linux 64-bit
google-cloud-cli-linux-arm.tar.gz
62.1 MB
caed087877643852ddbe9f7eedba5057431006971a9f0970cffc247f86eef09c
Linux 32-bit
google-cloud-cli-linux-x86.tar.gz
62.1 MB
a95e21de373341cce14edb3d29913ef99fad6a3fa5179d989ff13114aaab1494
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
*.tar.gz package name that applies to your configuration.
tar -xf google-cloud-cli-linux-x86_64.tar.gz
google-cloud-sdk directory and then extract the archive to the
same location.
./google-cloud-sdk/install.sh
Y when prompted.
You can also perform the installation non-interactively by providing flags.
To view available flags, run:
PATH../google-cloud-sdk/install.sh --helpPATH in the previous step, open a new
terminal so that the changes take effect.
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.
sudo apt-get update
ca-certificates, gnupg,
and curl installed. To install these packages, run the following command:
sudo apt-get install ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
--keyring argument, run the
following command:curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
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
echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-cli
apt-get options, such as disabling prompts or dry runs,
refer to the apt-get man pages.
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
gpg --dearmor command:
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
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-testskubectlgoogle-cloud-cli-app-engine-java component can be installed as
follows:
sudo apt-get install google-cloud-cli-app-engine-java
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
google-cloud-sdk.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.
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-cli]
name=Google Cloud CLI
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
EOM
gpgkey:sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el10-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key-v10.gpg
EOM
https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-aarch64
(RHEL 7, 8, or 9-compatible) or
https://packages.cloud.google.com/yum/repos/cloud-sdk-el10-aarch64
(RHEL 10-compatible) as the baseurl value.
libxcrypt-compat.x86_64.
sudo dnf install libxcrypt-compat.x86_64
sudo dnf install google-cloud-cli