The Wayback Machine - https://web.archive.org/web/20240828051350/https://www.geeksforgeeks.org/how-to-install-gcp-cli-in-linux-windows/
Open In App

How To Install GCP CLI In Linux, Windows ?

Last Updated : 20 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The gcloud, or Google Cloud Platform Command-Line Interface (CLI), simplifies organizing and managing the resources for GCP and provides many features and services. Users manage infrastructure continuously through continuous integration with GCP offerings like compute engines, cloud storage, and Kubernetes engines. The ability to script continuous processes with automation tools improves resource administration consistency and efficiency. Provides more security features to ensure that operations are safe and that help and documentation are available for all users. The GCP CLI, in its entirety, enables users to manage GCP resources, services, and infrastructure from the command line effectively. This article will teach us how to install the gcloud cli on Linux and Windows OS.

Featured in Google Cloud Command-line interface

Google Cloud Platform (GCP) CLI (Command Line Interface) is a powerful tool for managing GCP resources and services from the command line. Here’s what it offers:

  • Resource Management: Google Cloud provides virtual machines, storage buckets, databases, and various other GCP resources that can be created, managed, removed, and modified.
  • Service Interaction: Connect or establish a connection with the different GCP services, like BigQuery, Cloud Storage, Kubernetes Engine, and Compute Engine.
  • Deployment: Access tools like Cloud Functions, App Engine, and Cloud Run to deploy and manage the applications on the GCP infrastructure.
  • Monitoring: Keep an eye on and evaluate the functionality and condition of your GCP services and resources.
  • Security: To ensure safe operations, manage permissions and access control for GCP resources.
  • Networking: Manage and configure networking components, including subnets, firewall rules, VPNs, and virtual private clouds (VPCs).
  • Integration: Take advantage of APIs and SDKs to integrate GCP services with external tools and systems.
  • Automation: Scripting and automation features can be used to automate workflows and routine tasks.
  • Cost Management: For the best possible spending, keep an eye on and manage the GCP resource costs.
  • Cross-Platform Support: Available for several operating systems (OS), providing administrators and developers options, including Linux, macOS, and Windows.

Steps to Configure GCP Cli on Linux

How to launch a virtual machine on GCP

Step 1: SSH to a virtual machine. I have taken Ubuntu OS.

SSH to VM

Step 2: Using below command update the packages

sudo apt-get update

Update packages

Step 3: To install the required packages and dependencies on a Linux machine running Debian, execute the command below.

sudo apt-get install apt-transport-https ca-certificates gnupg curl

Install necessary Packages

Step 4: The Google Cloud apt-key.gpg file is downloaded via cURL by the command below, which then streams it to GPG to dearmor and converts it to binary format. Once the output has been dearmored, it is saved in the /usr/share/keyrings directory as cloud.google.gpg. Usually, this procedure is employed to safely append a GPG key to the system’s keyring, enabling the system to authenticate packages obtained from the Google Cloud repository.

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg

Gcloud apt key

Step 5: Using the below command to verify the package is added or not into the repository.

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

Verify Package

Step 6: Using apt-get update, the program below first modifies the package lists for all accessible software repositories. Next, it uses apt-get install to install the Google Cloud CLI (google-cloud-cli) package. The && operator ensures that the second command (apt-get install google-cloud-cli) will not be run until the first action (apt-get update) has properly completed. The past ten releases are always available in the repository.

sudo apt-get update && sudo apt-get install google-cloud-cli

Download gcloud cli

Step 7: Verify the Gcloud Cli using the below command.

gcloud --version

gcloud version

Steps to Congigure GCP Cli on Windows

Step 1: Refre the official document and get the official link to download the gcloud exe file on our local. I have downloaded the using the below link from the official documentation.

 https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe

Exe file on Local

Step 2: Docuble click on google cloud SDK installer (i.e., Gcloud exe file) or Run as a administrator and click on next.

SDK installer

Step 3: Read the terms and policies and agree the agreement by clicking the I agree button.

Verify Agreement

Step 4: Select the user based on our requirement single or all users and click on next.

Specify Users

Step 5: By Default the path selected if you want you can change the installation path by clicking the browse option then click on next.

Path to Install

Step 6: Select the component to install form the gcloud package. Recomoned to leave it default then click on install.

Required components

Step 7: Below image shows the installation of gcloud cli. This will take few minutes to install the gcloud. Afret installation completed click on Next.

Installing

Step 8: After installation click on finish and configure the our project.

gcloud init

Gcloud

Below image shows the afte execution of gcloud init

Gcloud -cli

Autenticate the ourproject by clicking the continue and enter our credentials.

Authenticate to Project

Afte succesfull authentication click on allow to access the our project.

Authorize

Below images shows the lick of projects and select oue project

Projects list

GCP cli in linux, windows – FAQ’s

How to install GCP CLI on Windows?

To install the Google Cloud CLI on Windows, download and run the installer provided by Google Cloud Platform. Follow the installation prompts to set up the CLI on your Windows system.

How do I know if GCP CLI is installed?

To check if the Google Cloud CLI is installed, open a command prompt or terminal and run the command “gcloud version”. If the CLI is installed, you’ll see the version information displayed.



Similar Reads

How To Create GCP Bucket Using CLI ?
Users can store and manage their data in the cloud with Google Cloud Storage (GCS), the service is provided by the Google Cloud Platform (GCP). Having the big virtual hard drive to store files, documents, photos, movies, and other media is similar to that. Within Google Cloud Storage, a bucket refers to a folder or container where you can group and
4 min read
Microsoft Azure - Create App Service Plan for Windows Service using CLI
Pre-requisite:- Azure An App Service Plan is a subscription model for hosting apps on Azure. It allows you to host multiple apps on a single server without paying for each app separately. This article will show you how to deploy an Azure App Service Plan with Windows service type using Azure CLI (Command Line Interface) from Azure Portal using Clou
2 min read
How to Install AWS CLI on Ubuntu?
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts. Here are the step-by-step instructions to install AWS CLI on UbuntuStep 1: Update package ListsOpen a terminal and update the
3 min read
Microsoft Azure - Create App Service Plan For Linux (Azure CLI)
An app service plan is a subscription model for hosting apps on Azure. It allows you to host multiple apps on a single server without having to pay for each app separately. In this article, we will show you how to deploy an Azure App Service Plan for Linux service type using Azure CLI (Command Line Interface) from Azure Portal in simple easy steps.
2 min read
Download & Install Terraform on Windows, Linux
A vital part of efficiently handling and provisioning cloud resources is infrastructure as code, or IaC. HashiCorp's open-source Terraform tool has become a top option for infrastructure-as-a-service (IaC) due to its ease of use, adaptability, and wide range of support for cloud providers and services. Terraform is crucial for learning, regardless
8 min read
Key GCP Management Tools and Monitoring Services
Pre-requisite: Google Cloud Platform Google Cloud Platform (GCP) is a collection of cloud computing services offered by Google, including infrastructure as a service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) products. These services are designed to provide businesses with the tools and resources they need to run their a
4 min read
Key GCP Compute Services
Pre-requisite:- GCP To create and run a Virtual Machine in the Google Cloud Platform, one needs Compute Services to perform certain operations. Google Cloud Platform's Compute Engine provides a variety of computing options according to users' needs. Some of them are discussed below along with their use cases: Cloud Dataproc:Cloud Dataproc is a mana
4 min read
Cloud Functions in GCP
Cloud Functions are a serverless computing service offered by Google Cloud Platform (GCP). They provide a simple way to run code in response to events with minimal configuration and maintenance. Cloud Functions are event-driven, meaning they can be triggered by events such as changes in data, new messages, and user interactions. Cloud Functions in
5 min read
How to Use Cloud Datastore For NoSQL Database On GCP?
Developers can store and retrieve data using Cloud Datastore, a powerful NoSQL document database offered by Google Cloud Platform (GCP). This detailed article will examine the major elements of using Cloud Datastore as a NoSQL database on GCP, covering everything from setup to advanced querying and performance optimization. What is Cloud Datastore?
6 min read
What is Key GCP Security Services?
Managing security in the cloud needs a different strategy due to constantly evolving threats. Therefore, risk management practices must be an important part of cloud security systems. GCP security tools are a good start for the cloud security journey. The GCP follows a shared responsibility model for the security where customers own the security of
6 min read
How To Create a Free Tier Account on GCP?
Like rivals Amazon Web Services (AWS) and Microsoft Azure, GCP is a provider of public clouds. Customers can use Google's global data center-based computing resources for free or pay-per-use through GCP and other cloud suppliers. GCP offers a comprehensive set of computing services that include everything from data management to web and video deliv
1 min read
How to Create a Load Balancer on GCP?
A load balancer in GCP (Google Cloud Platform) is a service that distributes incoming network traffic across multiple backend resources such as virtual machines (VMs), container instances, and managed instance groups. The main purpose of a load balancer is to improve the availability and scalability of the backend resources by distributing the inco
4 min read
How to Use Cloud Debugger For Debugging Applications On GCP?
Application debugging is a crucial step in the development process since it enables developers to quickly find and fix problems. Developers can debug their applications running on the Google Cloud Platform (GCP) with the help of a potent tool called Cloud Debugger without interfering with their regular operation. In this article, we'll examine Clou
4 min read
How to Use Cloud Pub/Sub for Event-driven Architecture on GCP?
Pre-requisites: Google Cloud Services Cloud Pub/Sub is a fully managed, scalable messaging system offered by Google Cloud Platform (GCP) that enables asynchronous communication between applications. It is a simple and reliable way to exchange data between services and applications in real time. With its event-driven architecture, Cloud Pub/Sub prov
3 min read
How to Use Cloud SQL For MySQL with Automatic Failover on GCP?
Google Cloud Platform (GCP) is a Cloud Service Provider that offers different service models like Iaas(Infrastructure as a service), Paas(Platform as a service), and Saas(Software as a service). Cloud SQL is a relational Database service offered by Google. Users can run MySQL, SQL Server, and PostgreSQL databases on GCP without having the headache
7 min read
How to Use Cloud NAT For Outbound Internet Access on GCP?
NAT Gateway is a Network address translation gateway that enables multiple devices to access a public network through a single IP address. It is mainly used to conserve registered IP addresses and use private IP addresses instead. Cloud NAT is used to expose internal private resources to the internet. We will see step by step process to do the same
3 min read
How to Use Cloud Identity and Access Management (IAM) For Access Control on GCP?
IAM defines "who can do what on which resource". Cloud IAM (Identity Access Management) offers a standardized set of functions and integrates access management for Google Cloud services into a single solution. You can create and manage permissions for Google Cloud resources using the Identity and Access Management (IAM) service provided by Google C
7 min read
How to Deploy a Web Application on GCP?
Google Cloud Platform is one of the cloud service providers that provide various cloud services for a seamless experience. It provides various services like storage, networks, development tools, Analytics tools, infrastructure, and many more. Benefits Of Deploying Web Applications on Google Cloud Platform GCP provides high availability which makes
4 min read
How to Use Cloud TPU for High-Performance Machine Learning on GCP?
Google's Cloud Tensor Processing Units (TPUs) have emerged as a game-changer in the realm of machine learning. Designed to accelerate complex computations, these TPUs offer remarkable performance enhancements, making them an integral part of the Google Cloud Platform (GCP). This article aims to provide a comprehensive guide on how to utilize Cloud
4 min read
How to Deploy Kubernetes on GCP?
Kubernetes, the open-supply field orchestration platform, has emerged as the standard for coping with containerized applications. Google Cloud Platform (GCP) provides a robust and scalable surrounding for deploying Kubernetes clusters. In this comprehensive manual, we are able to walk you through the steps to set up Kubernetes on GCP, leveraging it
5 min read
How To Create a Pub/Sub Topic on GCP?
Pub/Sub is a messaging service that allows you to send and receive messages between independent applications. Separating the senders and receivers enables secure and consistent communication between independently developed applications. With Pub/Sub, you can expect quick delivery of messages while ensuring their durability. This messaging service i
2 min read
Terraform GCP Resource Automation
Terraform is a popular tool for framework mechanization that permits you to describe your framework in an explanatory way using straightforward language structure or syntax. It gives a way to automate the creation, adjustment, modification, and erasure of cloud assets across various cloud providers, counting GCP (Google Cloud Platform) Pre-requisit
3 min read
How To Set Up A Multi-Region Load Balancer On GCP?
Load balancing is necessary in case of any production-ready application. The load balancer is used for load balancing. The main goal here is to distribute the incoming traffic across multiple regions to ensure the high availability and high reliability of an application. Google Cloud Platform provides us with services to configure load balancers fo
8 min read
How To use Cloud Speech-To-Text For Speech Recognition On GCP?
Google Cloud Platform is one of the famous cloud service providers in the market. With cloud features focusing on deployment and storage, GCP also provides features like speech recognition. This powerful and easy-to-use service is called Cloud speech-to-text. This functionality enables developers to convert spoken language into text with high accur
6 min read
How To Create Custom Dashboards In GCP ?
Google Cloud Platform (GCP) Monitoring is a comprehensive solution for monitoring cloud services and applications' health, performance, and availability. By providing real-time insights into application performance, resource metrics, and user experience, it assists businesses in guaranteeing the dependability and effectiveness of their cloud infras
4 min read
How To Create A GCP Project ?
Google Cloud Platform is one of the leading providers of cloud computing in the industry. GCP provides multiple services, like infrastructure as a service (IaaS), platform as a service (PaaS), and many more. Using the Google Cloud Platform, businesses can get rid of managing physical servers and instead use internet facilities to scale up their bus
7 min read
How To Configure Cloud Spanner In GCP ?
In today's era when data is everywhere, the demand for databases which can seamlessly accumulate massive amount of data is increasing. Databases also have to provide consistency, reliability and high availability. Google Cloud Platform is one of famous cloud providers in the market providing cloud solutions including storage and databases. Cloud Sp
7 min read
How To Create Storage Bucket In Gcp Using Terraform ?
In Cloud Computing, it is very crucial to provide efficient storage solutions. Google Cloud Platform (GCP) offers an exemplary service through it's Storage Bucket. Storage Buckets are versatile containers for securely storing data objects, while providing scalability, durability, and global accessibility. However, manually configuring these type of
6 min read
How To Create Alerts In GCP ?
Monitoring through the Google Cloud Platform (GCP) enables resource monitoring in the cloud. You will be able to monitor their performance, discover problems early, and make sure everything goes according to plan. You can maintain control over your cloud services and the smooth operation of your apps with GCP monitoring. Importance of setting up al
5 min read
How To Create VPC In GCP Using Terraform ?
When we are building an application to be hosted on a Cloud Platform we must configure networks and take security measures. If you are building an application that is open to users over the internet, you might want to control who gets access or not, and how users interact with each other. This is essentially where you will need a VPC Network. A VPC
9 min read