GCP Cloud SDK installation and setup
Here in this article we will see how we can install the Cloud SDK tool and initialize our shell environment. Also we will see how we can use how we can install the Programming language specific Client tools from this shell.
Test Environment
Fedora 32 installed
Active GCP account
What is Cloud SDK
Cloud SDK is set of command line tools that can be used to manage the Google cloud platform resources and applications hosted on this platform. Cloud SDK is almost similar to Google cloud console which is also used to manage and monitor the resources, but it has much more flexibility and comes with a set of Programming language specific command line libraries which can be installed and used from within the languagee specific programs to interact with the resources.
Procedure
Step1: Setup the Cloud SDK repository
Here in this step we are going to configure the yum repository with the Cloud SDK repository from which we will be able to install the Cloud SDK tool.
File: /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
Step2: Install Google Cloud SDK
Once the repository is configured we can install the Cloud SDK tool as shown below and validate its version.
sudo dnf install google-cloud-sdk
Verify the gcloud version that is installed.
gcloud --version
Step3: Initialize the Google Cloud SDK
Once the Cloud SDK tool is installed we need to initialize it with the project, zone, region and authentication credentials that will be used to manage the resources.
gcloud init
Output:
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use sxxx@gmail.com by default
* Commands will reference project `gcplearning-299822` by default
* Compute Engine commands will use region `asia-south1` by default
* Compute Engine commands will use zone `asia-south1-a` by default
Run `gcloud help config` to learn how to change individual settings
This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.
Step4: Validate the initial configuration
We can validate the basic information about our default configuration initialized as shown below.
gcloud auth list
Output:
Credentialed Accounts
ACTIVE ACCOUNT
* sxxx@gmail.com
To set the active account, run:
$ gcloud config set account `ACCOUNT`
Let’s now check our gcloud config using the below.
gcloud config list
[compute]
region = asia-south1
zone = asia-south1-a
[core]
account = sxxx@gmail.com
disable_usage_reporting = True
project = gcplearning-299822
Your active configuration is: [default]
Complete information about the installation paths and libraries that are installed is available with the below command.
gcloud info
Step5: List gcloud components and their Status
gcloud components list
Output:
Your current Cloud SDK version is: 321.0.0
The latest available version is: 321.0.0
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬──────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.9 MiB │
│ Not Installed │ Appctl │ appctl │ 21.0 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 7.7 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 6.6 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ 1 MiB │
...
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.9 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 59.6 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.1 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries) │ app-engine-python-extras │ 27.1 MiB │
Step6: Install app-engine-python Cloud Component
gcloud components install app-engine-python
Error:
ERROR: (gcloud.components.install)
You cannot perform this action because the Cloud SDK component manager
is disabled for this installation. You can run the following command
to achieve the same result for this installation:
sudo yum install google-cloud-sdk-app-engine-python
As per the above error message lets try to install the component using the package manager as Cloud SDK component manager is disabled if we install the SDK using the package repository.
sudo yum install google-cloud-sdk-app-engine-python
Step7: Validate the app-engine-python Cloud Component installation
gcloud components list | grep -i "app-engine"
Output:
Your current Cloud SDK version is: 321.0.0
The latest available version is: 321.0.0
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.9 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 59.6 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries) │ app-engine-python-extras │ 27.1 MiB │
│ Installed │ gcloud app Python Extensions │ app-engine-python │ 6.1 MiB │
Hope you enjoyed reading this article. Thank you..
Leave a Reply
You must be logged in to post a comment.