Install and Setup Google Cloud SDK on Linux CentOS

Google Cloud SDK (gcloud)contains tools and libraries that enable you to easily create and manage resources on Google Cloud Platform. Installing Google Cloud SDK(gcloud) is quite simple and Google does all the work for you.

  • you will need to run the following command logged as root user.
[root@aodba ~]# curl https://sdk.cloud.google.com | bash

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   421    0   421    0     0   2941      0 --:--:-- --:--:-- --:--:--  2944

Downloading Google Cloud SDK install script: https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash
######################################################################## 100.0%
Running install script from: /tmp/tmp.vqR8KWtzfk/install_google_cloud_sdk.bash
which curl
curl -# -f https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
######################################################################## 100.0%

Installation directory (this will create a google-cloud-sdk subdirectory) (/root):
mkdir -p /root
tar -C /root -xvf /tmp/tmp.Vq43J44XDL/google-cloud-sdk.tar.gz
google-cloud-sdk/
google-cloud-sdk/lib/
google-cloud-sdk/lib/third_party/
........
........
........
/root/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized data on how
the SDK is used. You may choose to opt out of this collection now (by choosing
'N' at the below prompt), or at any time in the future by running the following
command:
 gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)? n


This will install all the core command line tools necessary for working with
the Google Cloud Platform.



Your current Cloud SDK version is: 94.0.0
Installing components from version: 94.0.0

┌────────────────────────────────────────────────────────────────────────────┐
 These components will be installed. 
├─────────────────────────────────────────────────────┬────────────┬─────────┤
 Name  Version  Size 
├─────────────────────────────────────────────────────┼────────────┼─────────┤
 BigQuery Command Line Tool  2.0.18  < 1 MiB 
 BigQuery Command Line Tool (Platform Specific)  2.0.18  < 1 MiB 
 Cloud SDK Core Libraries (Platform Specific)  2015.11.24  < 1 MiB 
 Cloud Storage Command Line Tool  4.16  2.6 MiB 
 Cloud Storage Command Line Tool (Platform Specific)  4.15  < 1 MiB 
 Default set of gcloud commands   
└─────────────────────────────────────────────────────┴────────────┴─────────┘

For the latest full release notes, please visit:
 https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.

Update done!


Modify profile to update your $PATH and enable shell command
completion? (Y/n)? Y

The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/root/.bashrc]:
Backing up [/root/.bashrc] to [/root/.bashrc.backup].
[/root/.bashrc] has been updated.
Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
 https://developers.google.com/cloud/sdk/gettingstarted
Restart your Shell:
[root@aodba ~]# exec -l $SHELL
Set up a your gcloud tool default configuration:
  • to be able to manage your Google Cloud Account you need to create the configuration file.
  • you need to follow the instructions given by the installer.
  • you can choose the default options or use customized as well.
[root@aodba~]#  gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

To continue, you must login. Would you like to login (Y/n)?  Y

Go to the following link in your browser:

    https://accounts.google.com/o/oauth2/auth?redirect_uri=urn%%2.0%3Aoob&amp;prompt=select_account&amp;response_type
=code&amp;client_id=.apps.googleunt.com&amp;scope=htt%2Fwww.googleapis.uth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis
.com%2Fauth%2Fcloud-platform+2F%2Fwww.googleapis.com%2Fauth%2Fapp.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcss_type=offline


Enter verification code: 4/k-Ewbvug_D5qrSb6CKS_ODqLrWIAA38
You are now logged in as: [[email protected]]

Pick cloud project to use:
 [1] [aodba-gs-10]
Please enter your numeric choice:  1

Your current project has been set to: [aodba-gs-10].

Which compute zone would you like to use as project default?
 [1] [asia-east1-c]
 [2] [asia-east1-a]
 [3] [asia-east1-b]
 [4] [europe-west1-b]
 [5] [europe-west1-c]
 [6] [europe-west1-d]
 [7] [us-central1-f]
 [8] [us-central1-a]
 [9] [us-central1-c]
 [10] [us-central1-b]
 [11] [us-east1-d]
 [12] [us-east1-c]
 [13] [us-east1-b]
 [14] Do not set default zone
Please enter your numeric choice:  14

Which compute region would you like to use as project default?
 [1] [asia-east1]
 [2] [europe-west1]
 [3] [us-central1]
 [4] [us-east1]
 [5] Do not set default region
Please enter your numeric choice:  1

Your project default compute region has been set to [asia-east1].
You can change it by running [gcloud config set compute/region NAME].

Do you want to use Google's source hosting (see
https://cloud.google.com/tools/cloud-repositories/) (Y/n)?  n


gcloud has now been configured!
You can use [gcloud config] to change more gcloud settings.

Your current configuration is: [default]

Your active configuration is: [default]

[compute]
region = asia-east1
[core]
account = [email protected]
disable_usage_reporting = True
project = aodba-gs-10
List installed version of gcloud utility.
  • after configuration is complete you can list the available tools using the command bellow:
[root@aodba ~]# gcloud --version

Google Cloud SDK 94.0.0

bq 2.0.18
bq-nix 2.0.18
core 2016.01.22
core-nix 2015.11.24
gcloud
gsutil 4.16
gsutil-nix 4.15
So we finished installing Google Cloud SDK command-line interface. In the next articles we will go over the utilities that come with the gcloud tool.