This brief tutorial shows students and new users how to install Google Cloud SDK on Ubuntu 20.04 | 18.04.
Google Cloud SDK is a software toolset that helps developers and users manage cloud services hosted on Google Cloud Platform.
The packaged toolset contains the gcloud, gsutil, and bq commands and is available in package format for installation on Ubuntu as well as other Linux systems.
In Ubuntu there are multiple ways to install Google Cloud SDK. Ubuntu users can use its official APT repository and also install from Snap package management.
To get started with installing Google Cloud SDK in Ubuntu, follow the steps below:
Before you can install the cloud package, make sure these packages are installed on Ubuntu.
To install them simply run the commands below:
sudo apt update sudo apt install curl apt-transport-https ca-certificates gnupg
After installing the required packages above, continue below to install it.
Install from Official Repository
Google has made available an official repository from install the cloud package from.
In most cases you’ll want to install from this repository since Ubuntu will download and install newer packages automatically when available.
Add the Cloud SDK distribution URI as a package source by running the commands below:
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
After that, import the Google Cloud public key by running the commands below:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
Update and install the cloud SDK.
sudo apt update sudo apt install google-cloud-sdk
Running the commands above will install Google Cloud SDK on Ubuntu. You can now start management your Google Cloud Platform from your Ubuntu machine.
Install from Snap
If you don’t want to use the method above, you can simply follow the steps below to install it.
Google Cloud SDK is available in Ubuntu Snap package management. Snap is available by default on Ubuntu 20.04. However, if you’re using older version of Ubuntu, you may need to install it.
To install Google Cloud SDK via Snap, simply run the commands below:
sudo apt update sudo apt install snapd sudo snap install google-cloud-sdk --classic
That will install the cloud sdk tools on your machine.
The two methods above should work fine, however, installing from Snap is the quickest way.
Initialize Cloud SDK
Either method above will work just fine. Whichever method you use, you’ll have to initialize your environment using the commands below.
After installing, run the commands below to initialize the cloud environment.
sudo gcloud init
Running the commands above will prompt you to authorize the Cloud SDK tools to use your Google account credentials to access Google Cloud and manage it.
Welcome! This command will take you through the configuration of gcloud. Your current configuration has been set to: [default] You can skip diagnostics next time by using the following flag: gcloud init --skip-diagnostics Network diagnostic detects and fixes local network connection issues. Checking network connection...done. Reachability Check passed. Network diagnostic passed (1/1 checks passed). You must log in to continue. Would you like to log in (Y/n)?
Follow the initialization wizard and complete the setup. You’ll have to open the URL link provided and login via your Google account.
This post showed you how to install and setup Google Cloud SDK on Ubuntu. If you find any error above, please use the comment form below to report.
You may also like the post below: