How to Install gcloud SDK on CentOS 7 using best steps

In this article, I will take you through the steps to install gcloud SDK on CentOS 7. Google Cloud Platform, offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search and YouTube.

Install gcloud SDK

In order to install gcloud sdk you need to go through the prerequisites first before you start the setup procedure.

Prerequisites

You need to have a RedHat/CentOS 7 machine along with Internet connection to install gcloud sdk.

How to Install gcloud SDK on CentOS 7 using best steps 1

Check your GCP Login

Before following the steps to install google cloud sdk, check your gcp login credentials and confirm if you are able to login. Once confirmed, please proceed with below steps.

Setup the Repository

We need to first setup the repo for gcloud sdk tools installation.

[root@localhost ~]# cat /etc/yum.repos.d/google-cloud-sdk.repo
[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

Install Google Cloud SDK

To install google cloud SDK, we need to use yum command to download and install google cloud sdk tools.

[root@localhost ~]# yum install google-cloud-sdk
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.praction.in
* extras: mirrors.praction.in
* updates: mirrors.praction.in
google-cloud-sdk/signature | 454 B 00:00
Retrieving key from https://packages.cloud.google.com/yum/doc/yum-key.gpg
Importing GPG key 0xA7317B0F:
Userid : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>"
Fingerprint: d0bc 747f d8ca f711 7500 d6fa 3746 c208 a731 7b0f
From : https://packages.cloud.google.com/yum/doc/yum-key.gpg
Is this ok [y/N]: y
Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gp g
google-cloud-sdk/signature | 1.4 kB 00:02 !!!
google-cloud-sdk/primary | 135 kB 00:01
google-cloud-sdk 976/976
Resolving Dependencies
--> Running transaction check
---> Package google-cloud-sdk.noarch 0:268.0.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
google-cloud-sdk noarch 268.0.0-1 google-cloud-sdk 36 M

Transaction Summary
================================================================================
Install 1 Package

Total download size: 36 M
Installed size: 172 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/google-cloud-sdk/packages/3116074ce3e3dae6f79db e05a927f6d8d05f167b0c238d318b9223de51a90771-google-cloud-sdk-268.0.0-1.noarch.rp m: Header V4 RSA/SHA1 Signature, key ID 3e1ba8d5: NOKEY
Public key for 3116074ce3e3dae6f79dbe05a927f6d8d05f167b0c238d318b9223de51a90771- google-cloud-sdk-268.0.0-1.noarch.rpm is not installed
3116074ce3e3dae6f79dbe05a927f6d8d05f167b0c238d318b9223de51 | 36 MB 00:05
Retrieving key from https://packages.cloud.google.com/yum/doc/yum-key.gpg
Importing GPG key 0xA7317B0F:
Userid : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>"
Fingerprint: d0bc 747f d8ca f711 7500 d6fa 3746 c208 a731 7b0f
From : https://packages.cloud.google.com/yum/doc/yum-key.gpg
Is this ok [y/N]: y
Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gp g
Importing GPG key 0x3E1BA8D5:
Userid : "Google Cloud Packages RPM Signing Key <gc-team@google.com>"
Fingerprint: 3749 e1ba 95a8 6ce0 5454 6ed2 f09c 394c 3e1b a8d5
From : https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : google-cloud-sdk-268.0.0-1.noarch 1/1
Verifying : google-cloud-sdk-268.0.0-1.noarch 1/1

Installed:
google-cloud-sdk.noarch 0:268.0.0-1

Complete!

Verify the Installation

Once done, we can check if it is installed or not.

Advertisements
[root@localhost ~]# gcloud info
Google Cloud SDK [268.0.0]

Platform: [Linux, x86_64] ('Linux', 'localhost.localdomain', '3.10.0-1062.1.2.el 7.x86_64', '#1 SMP Mon Sep 30 14:19:46 UTC 2019', 'x86_64', 'x86_64')
Locale: ('en_US', 'UTF-8')
Python Version: [2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Re d Hat 4.8.5-39)]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]

Installation Root: [/usr/lib64/google-cloud-sdk]
Installed Components:
core: [2019.10.18]
kubectl: [2019.10.18]
beta: [2019.10.18]
gsutil: [4.45]
bq: [2.0.49]
alpha: [2019.10.18]
System PATH: [/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin]
Python PATH: [/usr/lib64/google-cloud-sdk/lib/third_party:/usr/lib64/google-clou d-sdk/lib:/usr/lib64/python27.zip:/usr/lib64/python2.7/:/usr/lib64/python2.7/pla t-linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-old:/usr/lib64/pyt hon2.7/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [False]

Installation Properties: [/usr/lib64/google-cloud-sdk/properties]
User Config Directory: [/root/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/root/.config/gcloud/configurations/config_default]

Account: [None]
Project: [None]

Current Properties:
[core]
disable_usage_reporting: [True]

Logs Directory: [/root/.config/gcloud/logs]
Last Log File: [/root/.config/gcloud/logs/2019.10.22/15.20.57.983007.log]

git: [NOT AVAILABLE]
ssh: [OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017]

What about error “gcloud command not found”

Sometimes we get an error “gcloud command not found” while using gcloud command. It is mostly because gcloud command is not detected by System. To resolve this error, you need to make sure gcloud command is available in standard Linux directory like /usr/sbin,/usr/sbin etc. If it is installed somewhere else, then you can search that path from below command and set that path in Bash Environment variable. Make sure to run below command as root user.

[root@localhost ~]#find / -name gcloud

How to update components using gcloud update

Sometimes there is a requirement to update google cloud components, in that scenario you need to use gcloud update to update all the required components. Below is the syntax to use that command:-

gcloud components update [--version=VERSION] [GCLOUD_WIDE_FLAG …]

Google Connect through SSH

Google connecting through ssh can be done on public IP 104.198.98.165 as mentioned below.

How to Install gcloud SDK on CentOS 7 using best steps 2

Also Read: Oracle Cloud IaaS Set Up

Reference: Google Cloud

Advertisements

Leave a Reply