Google Cloud SDK documentation

Google Cloud SDK is a set of tools that you can use to manage resources and applications hosted on Google Cloud Platform. These include the gcloud, gsutil, and bq command line tools. The gcloud command-line tool is downloaded along with the Cloud SDK; a comprehensive guide to the gcloud CLI can be found in gcloud command-line tool overview.

Additionally, the gcloud CLI reference documents all of the gcloud CLI's functionality.

Install the latest Cloud SDK version (273.0.0)

Linux
  1. Make sure that your system has Python 2 with a release number of Python 2.7.9 or higher. You may still have other versions of Python installed.

    python2 --version
  2. Download one of the following:
  3. Platform Package Size SHA256 Checksum
    Linux 64-bit

    (x86_64)

    google-cloud-sdk-273.0.0-linux-x86_64.tar.gz 30.3 MB dc160e254980c256039b9f9f77040422792b12c92f823deb4674f41d274a6e00
    Linux 32-bit

    (x86)

    google-cloud-sdk-273.0.0-linux-x86.tar.gz 29.9 MB 69951125d1a8d75e7a907664a19662aa653de6aa0b23e505483c8192598afb46

  4. Extract the contents of the file to any location on your file system. If you would like to replace an existing installation, remove the existing google-cloud-sdk directory and extract the archive to the same location.
  5. Optional. Use the install script to add Cloud SDK tools to your path. You'll also be able to opt-in to command-completion for your shell and usage statistics collection. Run the script using this command:
    ./google-cloud-sdk/install.sh
    
    Open a new terminal so that the changes take effect.
  6. Run gcloud init to initialize the SDK:
  7. ./google-cloud-sdk/bin/gcloud init
    
  8. Optional. Install additional components using the component manager.
Debian/Ubuntu

Cloud SDK is available in package format for installation on Debian and Ubuntu systems. This package contains the gcloud, gcloud alpha, gcloud beta, gsutil, and bq commands only. It 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.

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.

  1. Add the Cloud SDK distribution URI as a package source:
    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
    Note: Make sure you have apt-transport-https installed:
    sudo apt-get install apt-transport-https ca-certificates gnupg
  2. Import the Google Cloud public key:
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
  3. Update and install the Cloud SDK:
    sudo apt-get update && sudo apt-get install google-cloud-sdk
    Note: For additional apt-get options, such as disabling prompts or dry runs, refer to the apt-get man pages.
  4. Optionally, install any of these additional components:
    • google-cloud-sdk-app-engine-python
    • google-cloud-sdk-app-engine-python-extras
    • google-cloud-sdk-app-engine-java
    • google-cloud-sdk-app-engine-go
    • google-cloud-sdk-bigtable-emulator
    • google-cloud-sdk-cbt
    • google-cloud-sdk-cloud-build-local
    • google-cloud-sdk-datalab
    • google-cloud-sdk-datastore-emulator
    • google-cloud-sdk-firestore-emulator
    • google-cloud-sdk-pubsub-emulator
    • kubectl

    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
  5. Run gcloud init to get started:
    gcloud init
Red Hat/CentOS

Cloud SDK is available in package format for installation on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 8, and CentOS 7 systems. This package contains the gcloud, gcloud alpha, gcloud beta, gsutil, and bq commands only. It does not include kubectl or the App Engine extensions required to deploy an application using gcloud commands, which can be installed separately.

Note: If you are using an instance on Google Compute Engine, Cloud SDK is installed by default.

  1. Update YUM with Cloud SDK repo information:
    sudo tee -a /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
    

    Important: The second line of gpgkey must be indented as shown.

  2. Install the Cloud SDK:
    yum install google-cloud-sdk
    Note: For additional yum options, such as disabling prompts or dry runs, refer to the yum man pages.
  3. Optionally, install any of these additional components:
    • google-cloud-sdk-app-engine-python
    • google-cloud-sdk-app-engine-python-extras
    • google-cloud-sdk-app-engine-java
    • google-cloud-sdk-app-engine-go
    • google-cloud-sdk-bigtable-emulator
    • google-cloud-sdk-cbt
    • google-cloud-sdk-cloud-build-local
    • google-cloud-sdk-datalab
    • google-cloud-sdk-datastore-emulator
    • google-cloud-sdk-firestore-emulator
    • google-cloud-sdk-pubsub-emulator
    • kubectl

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

    yum install google-cloud-sdk-app-engine-java
  4. Run gcloud init to get started:
    gcloud init
macOS
  1. Modern versions of macOS include the appropriate version of Python required for the Google Cloud SDK; Cloud SDK requires Python 2 with a release number of Python 2.7.9 or higher. Any additionally installed Python interpreters will not interfere with the Google Cloud SDK installation.
  2. python -V
    
  3. Download one of the following:
  4. Platform Package Size SHA256 Checksum
    macOS 64-bit

    (x86_64)

    google-cloud-sdk-273.0.0-darwin-x86_64.tar.gz 22.9 MB bf5057707b971f48edef4262123d6012e138e840990ff873ed83494b293f3409
    macOS 32-bit

    (x86)

    google-cloud-sdk-273.0.0-darwin-x86.tar.gz 22.9 MB 8e3e94b207025181dde5ee12304d46af880ba6f82579da40347ac856def048bc

  5. Extract the contents of the file to any location on your file system. If you would like to replace an existing installation, remove the existing google-cloud-sdk directory and extract the archive to the same location.
  6. Optional. Use the install script to add Cloud SDK tools to your path. You'll also be able to opt-in to command-completion for your shell and usage statistics collection. Run the script using this command:
    ./google-cloud-sdk/install.sh
    
    Open a new terminal so that the changes take effect.
  7. Run gcloud init to initialize the SDK:
  8. ./google-cloud-sdk/bin/gcloud init
    
  9. Optional. Install additional components using the component manager.
Windows
  1. Download the Cloud SDK installer.

    Alternatively, open a PowerShell terminal and run the following PowerShell commands.

    (New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
    
    & $env:Temp\GoogleCloudSDKInstaller.exe
          

  2. Launch the installer and follow the prompts. The installer is signed by Google LLC.

    Cloud SDK requires Python 2 with a release version of Python 2.7.9 or higher. The installer will install all necessary dependencies, including the needed Python version, by default. If you already have Python 2.x.y installed and want to use the existing installation, you can uncheck the option to install Bundled Python.

  3. After installation has completed, accept the following options:

    • Start Cloud SDK Shell
    • Run gcloud init

  4. The installer starts a terminal window and runs the gcloud init command.

  5. The default installation does not include the App Engine extensions required to deploy an application using gcloud commands. These components can be installed using the Cloud SDK component manager.

Install the latest Google Cloud Client Libraries

You can download Cloud Client Libraries for supported languages.

More information

क्या यह पेज उपयोगी था? हमारे काम के बारे में अपनी राय दें:

निम्न के बारे में फ़ीडबैक भेजें...