gcloud Installing Cloud SDK

https://cloud.google.com/sdk/downloads

This page contains instructions for downloading and installing Google Cloud SDK.

System requirements

Cloud SDK runs on Linux, Mac OS X and Windows, and requires Python 2.7.x. Some tools bundled with Cloud SDK have additional requirements. For example, Java tools for Google App Engine development require Java 1.7 or later.

Installation options

Do one of the following to install Cloud SDK:

  • Download a versioned archive of any release, including previous releases
  • Run the interactive installer to download and install the latest release
  • Use apt-get (Debian and Ubuntu only) to download and install the latest release

These installation methods install the default Cloud SDK components, which include gcloud,gsutil and bq command-line tools. You can install additional components using the gcloud components install command.

Versioned archives

Cloud SDK provides downloadable, versioned archives for each release. Each versioned archive contains a self-contained installation of Cloud SDK in a directory named google-cloud-sdk that can be copied to any location on your file system.

Versioned archives are designed for non-interactive installation of specific versions of Cloud SDK and are useful when:

  • You require a specific version of Cloud SDK. For example:
    • You are scripting with gcloud or one of the other Cloud SDK compoments and want to make sure that your scripts don’t break as the result of a Cloud SDK update.
    • You are using Cloud SDK as part of a CI (continuous integration) process or production system where you want to control your dependencies in order to ensure compatibility between parts of the system.
    • You are performing automated deployments of Cloud SDK to many machines that must be in sync with each other.
  • You don’t want to perform an interactive installation.

To install the latest release of Cloud SDK from a versioned archive:

  1. Download one of the following:
    Platform Package Size SHA1 Checksum
    Linux (x86_64) google-cloud-sdk-132.0.0-linux-x86_64.tar.gz 8.9 MB 4926b770df756f2e7828e626476e0b2d8fa9a551
    Linux (x86) google-cloud-sdk-132.0.0-linux-x86.tar.gz 8.9 MB 6938bc9407697c194f47096b0334074432b1a51c
    Mac OS X (x86_64) google-cloud-sdk-132.0.0-darwin-x86_64.tar.gz 8.9 MB 056bf36b8fd95ea983a724b9cdaa4f1ce6ece7e5
    Mac OS X (x86) google-cloud-sdk-132.0.0-darwin-x86.tar.gz 8.9 MB 5db62df619d356c84a4854afa04e900d5ffdb8c7
    Windows (x86_64) google-cloud-sdk-132.0.0-windows-x86_64.zip 13.5 MB 0355993645de45e43c8b749877b2618199302ca8
    Windows (x86_64) with Python google-cloud-sdk-132.0.0-windows-x86_64-bundled-python.zip 23.2 MB b7bdfba72cb79bb50637e9ad0f56d8284aaee6af
    Windows (x86) google-cloud-sdk-132.0.0-windows-x86.zip 13.5 MB c349d6cbcf8f2537eee7b64d1579d90b3e992b0c
    Windows (x86) with Python google-cloud-sdk-132.0.0-windows-x86-bundled-python.zip 23.2 MB 5e123936b2ff23f83caf51882fec86710a07ad53
  2. Extract the file to any location on your file system.
  3. Optional. Run the install script to add Cloud SDK tools to your path, enable command-completion in your bash shell (Linux and Mac OS only) and enable usage reporting.
    • On Linux or Mac OS X:
      ./google-cloud-sdk/install.sh
      
    • On Windows:
      .\google-cloud-sdk\install.bat
      

    Run install.sh --help or install.bat --help for a list of flags you can pass to this script.

  4. Run gcloud init to initialize the SDK:
    ./google-cloud-sdk/bin/gcloud init
    

Earlier versions

Earlier versions of Cloud SDK are available in the download archive in Google Cloud Storage.

Interactive installer

Cloud SDK also provides an interactive installer for each supported platform. The installer lets you download, install and set up the latest version of Cloud SDK quickly in interactive mode. When you run the installer, it downloads Cloud SDK components and installs them on the local system. It also performs additional setup tasks like adding Cloud SDK components to your PATH and enabling command completion in your shell.

LINUX
MAC OS X
WINDOWS
  1. Enter the following at a command prompt:
    curl https://sdk.cloud.google.com | bash
  2. Restart your shell:
    exec -l $SHELL
  3. Run gcloud init to initialize the gcloud environment:
    gcloud init

apt-get (Debian and Ubuntu only)

Cloud SDK is available in package format for installation on Debian and Ubuntu systems. This package contains the gcloud, gsutil and bq commands only.

You can install the Cloud SDK from a Debian/Ubuntu package for all official Ubuntu releases that have not reached end of life, and Debian stable releases from Wheezy forward.

Note: If you are using an instance on Google Compute Engine, Cloud SDK is installed by default. You can still manually install Cloud SDK using the instructions below.

The Cloud SDK deb package (google-cloud-sdk) does not 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 as described later in this section.

  1. Create an environment variable for the correct distribution:
    export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
  2. Add the Cloud SDK distribution URI as a package source:
    echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
  3. Import the Google Cloud public key:
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
  4. Update and install the Cloud SDK:
    sudo apt-get update && sudo apt-get install google-cloud-sdk
  5. Optionally install any of these additional components:
    • google-cloud-sdk-app-engine-python
    • google-cloud-sdk-app-engine-java
    • google-cloud-sdk-datastore-emulator
    • google-cloud-sdk-pubsub-emulator
    • google-cloud-sdk-bigtable-emulator

    For example, the google-cloud-sdk-app-engine-java component can be installed as follows:

    sudo apt-get install google-cloud-sdk-app-engine-java

    You can also install the kubectl Debian package using the instructions on the Kubernetes website.

  6. Run gcloud init to get started:
    gcloud init

yum install (Red Hat and CentOS)

Cloud SDK is available in package format for installation on Red Hat Enterprise Linux 7 and CentOS 7 systems. This package contains the gcloud, gsutil and bq commands only.

Note: If you are using an instance on Google Compute Engine, Cloud SDK is installed by default. You can still manually install Cloud SDK using the instructions below.

The Cloud SDK RPM package (google-cloud-sdk) does not 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 as described later in this section.

  1. Update YUM with Cloud SDK repo information:
        sudo tee /etc/yum.repos.d/google-cloud-sdk.repo << EOM
        [google-cloud-sdk]
        name=Google Cloud SDK
        baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
        enabled=1
        gpgcheck=1
        repo_gpgcheck=1
        gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
               https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
        EOM
        

    The indentation for the 2nd line of gpgkey is important.

  2. Install the Cloud SDK:
    yum install google-cloud-sdk
  3. Optionally install any of these additional components:
    • google-cloud-sdk-app-engine-python
    • google-cloud-sdk-app-engine-java
    • google-cloud-sdk-datastore-emulator
    • google-cloud-sdk-pubsub-emulator

    For example, the google-cloud-sdk-app-engine-java component can be installed as follows:

    yum install google-cloud-sdk-app-engine-java

    You can also install the kubectl RPM package using the instructions on the Kubernetes website.

  4. Run gcloud init to get started:
    gcloud init

Managing an installation

After you have installed Cloud SDK, you can use commands in the gcloud components command group to manage your installation. This includes viewing installed components, adding and removing components, and upgrading to a new version of Cloud SDK.

Leave a Reply

Your email address will not be published. Required fields are marked *