Before the installation of the gcloud
CLI, confirm that Python 3 is installed (Python 3.5 or higher, 3.7 is recommended).
Follow the following steps to install the Google Cloud CLI.
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:
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
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-sdk
directory and extract the content in thegoogle-cloud-sdk
directory.
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.
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
.
gcloud
Use the following command to initialize the gcloud
CLI:
./google-cloud-sdk/bin/gcloud init
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.