How to install Google Cloud CLI on Linux?
Pre-requisites
Before the installation of the gcloud CLI, confirm that Python 3 is installed (Python 3.5 or higher, 3.7 is recommended).
Installation steps
Follow the following steps to install the Google Cloud CLI.
Step 1: Download source
Download one of the following tarball depending upon your operating system. If you don’t know what your operating system is, run the getconf LONG_BIT command:
Linux 64-bit (x86_64) google-cloud-cli-387.0.0-linux-x86_64.tar.gz - Linux 64-bit (arm)
- Linux 32-bit (x86)
Or, run the following command to download the Linux 64-bit archive file:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-387.0.0-linux-x86_64.tar.gz
Run the following command to download the Linux 64-bit arm archive file:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-387.0.0-linux-arm.tar.gz
Run the following command to download Linux 32-bit archive file:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-387.0.0-linux-x86.tar.gz
Step 2: Extract the content
Run the following command to extract the content of the downloaded archive file.
tar -xf google-cloud-cli-387.0.0-linux-x86.tar.gz
Make sure the file name is correct after tar -xf. The above example is for the 32-bit archive file.
Note: To replace the existing installation, delete all content of the
google-cloud-sdkdirectory and extract the content in thegoogle-cloud-sdkdirectory.
Step 3: Install gcloud
From the root folder where you’ve extracted the archive file, run the following command to execute the installation script.
./google-cloud-sdk/install.sh
To install google-cloud-cli non-interactively, set all preferences as flags. Use the --help flag with the above command to see all preferences.
Step 4: Answer prompts
Answer Y to the prompt if you want to send the usage statistics anonymously to Google for the improvement of Google Cloud CLI.
Answer Y to the prompt to enable the command completion and to add the gcloud CLI to your PATH.
Step 5: Initialize gcloud
Use the following command to initialize the gcloud CLI:
./google-cloud-sdk/bin/gcloud init
Step 6: Install additional gcloud components (optional)
Use the following command to install the additional components of gcloud.
gcloud components install [COMPONENT_ID]
For example, use the following function to install the AppCtl component:
gcloud components install appctl
Similarly, update and remove keywords can be used instead of install to update and remove the gcloud components.
Unlock your potential: Google Cloud CLI installation series, all in one place!
If you've missed any part of the series, you can always go back and check out the previous Answers:
How to install Google Cloud CLI on macOS?
Step-by-step instructions for installing Google Cloud CLI on macOS.How to install Google Cloud CLI on Windows?
Learn how to set up Google Cloud CLI on Windows for seamless cloud interactions.How to install Google Cloud CLI on Debian/Ubuntu?
Get the necessary commands to install Google Cloud CLI on Debian/Ubuntu Linux distributions.How to install Google Cloud CLI on Linux?
Explore the process of setting up Google Cloud CLI on Linux systems for command-line cloud access.
Free Resources