title: “What Is Gcloud And How To Install On Windows Macos And Linux " ShowToc: true date: “2023-05-20” author: “Sandra Martone”
Imagine you want to view your GCP resources, provision an infrastructure without login to Google Cloud Console. gcloud can help in many ways.
What is gcloud?
gcloud is the desktop command-line tool for Google Cloud Platform. You can literally do everything with gcloud that you do on the cloud console. To take a look at a quick introduction, there is a list of the most used commands with a glimpse of their structured, execute gcloud cheat-sheet or see the official cheat sheet. You can do manage many things, like below.
Compute Engine (VMs) Cloud DNS Kubernetes Engine Cloud SQL Cloud Dataproc Cloud Deployment Deploying App Engine applications Manage authentication Customize the local configuration
and a lot more… gcloud is a cross-platform SDK that you can install on your favorite OS like Windows, macOS, Linux, etc.
Installing gcloud on Linux
Python is a prerequisite to install gcloud so ensure you have installed that on your computer or server. You can refer to this Python installation guide if you need to install it.
Depending on your OS, you can download the package between 32-bit or 64-bit from the official download page.
Example for 64-bit and, for 32-bit
Unzip the downloaded file which will create a new folder called google-cloud-sdk Run the install.sh file
Restart the terminal to enable the changes to take effect. Let’s initialize the gcloud SDK by running the below command.
Installing gcloud on Windows
As usual, things are much easier in Windows, simply download the Cloud SDK installer for Windows and execute it. Or if you prefer the terminal methods, open the PowerShell terminal (not the CMD), and execute these PowerShell commands: 2- The installer, signed by Google LLC, will prompt for next steps, follow them. Optionally, you may like to enable screen reader mode for a more streamlined screen reader experience, check the Turn on screen reader mode option. For more information about the Cloud SDK screen reader experience, open the Accessibility features guide. 3- As the Cloud SDK needs Python, you must install it and every other necessary dependency. The supported versions are Python 3 (preferred, 3.5 to 3.8) and Python 2 (2.7.9 or higher). That means you can use an existing Python installation, despite SDK currently uses Python 3 by default. This can be done by unchecking the option to Install Bundled Python. 4- Now, when the installation has been done, it gives you some options to choose from: Make sure to select these:
Start Google Cloud SDK Shell Run gcloud init
Now an SDK terminal window will appear and execute the gcloud init command automatically. 5- This installation is the default, therefore; it doesn’t contain the App Engine extensions needed to deploy an application using gcloud commands. You can install these components in the Cloud SDK component manager. Troubleshooting:
If you face installation failure because the find command was not recognized, make sure that your PATH environment variable is on the setting of include the folder containing find. It supposed to be: C:\WINDOWS\system32;. If you already just uninstalled Cloud SDK, you must restart your computer in order to install a new Cloud SDK.
For macOS
1- As with any other OS, for macOS, you also need Python for SDK. The supported versions are Python 3 (preferred, 3.5 to 3.8) and Python 2 (2.7.9 or higher). Furthermore, you can choose the macOS 64-bit with packed Python installation. Execute the following to check the current Python version: If you need more information about choosing and configuring your Python interpreter, visit gcloud topic startup. 2- There are four packages, choose to download what suit your OS from the following: Execute uname -m from your command line to determine the suitable machine hardware name. 3- Now unzip the file in any path you want in your file system, it’s recommended at your home directory. To do this on macOS, just open the downloaded .tar.gz archive file in the location you want. If you would like to replace an existing installation, remove the existing google-cloud-sdk directory and extract the archive to the same location. If you already have an existing installation, and you want to replace it, simply delete the old google-cloud-sdk directory and then extract the new package in the same location. 4- Optionally, you can use the install script to install additional Cloud SDK tools in the same PATH. Also, if you wish, you can contribute to command-completion for usage statistics collection and command-completion for your shell. Execute this script from the exact root of the folder that extracted the SDK: You can do it also non-interactively using a script or by providing preferences as flags, by executing this command: To execute the install script with screen reader mode on: Now restart the terminal to enable the changes to take effect. 6- To initialize the SDK, execute gcloud init: Optional:
Install additional SDK components from the component manager. Install the latest Google Cloud Client Libraries and libraries for supported languages.
Using Gcloud
The instruction above installs the default Cloud SDK components including gcloud, gsutil and bq command-line tools. To manage and use the installation after you have installed Cloud SDK, use commands in the gcloud components command group. Including viewing installed components, installing and removing components, and upgrading the Cloud SDK to a new version or even downgrading to a specific version. For installing additional components, use the gcloud components install command, or install the suitable deb or RPM packages.
Gcloud for Mobile
To use gcloud on a smart mobile phone, install the Google Cloud Console. For iPhone: Google Cloud Console| App Store. For Android: Google Cloud Console | Google play. Just open the shell black icon.
Conclusion
With these instructions, whatever your desire of using gcloud, in the browser, your computer, or simply in your smartphone. Whatever your operating system is, it’s clear that the whole process is quite easy to implement.