Setting up the Google Cloud SDK on Ubuntu 22.04 allows you to interact with Google Cloud services and manage resources from your Ubuntu-based system. The Google Cloud SDK includes various command-line tools and libraries for this purpose. Here are the steps to set up the Google Cloud SDK on Ubuntu 22.04.
What you actually get is three tools that do most of the work. gcloud handles compute, networking, IAM and everything else through the API. gsutil is for Cloud Storage buckets. bq talks to BigQuery. There are more, but those are the ones you will type daily.
Two ways to install it exist and it is worth knowing which one you are choosing. The apt repository, covered here, hooks the SDK into the system package manager so it updates alongside everything else. The other route is downloading the tarball, which suits machines where you want the version pinned and unaffected by a routine apt upgrade. Either works. The apt route is the one to take on a workstation you use every day.
Here are the general steps to install the Google Cloud SDK on Ubuntu 22.04:
Open a Terminal: You can open a terminal window by pressing Ctrl + Alt + T on your keyboard.
Update Package Lists:
$ sudo apt update
Install Required Dependencies:
The Google Cloud SDK requires curl and python3 as dependencies. You can install them using the following command:
$ sudo apt install curl python3 -y
Both are usually present on a desktop install already, so this often reports there is nothing to do. Run it anyway. On a minimal server image or inside a container neither is guaranteed, and finding out later produces an error that points at the SDK rather than the missing dependency.
Add the Google Cloud SDK Repository:
To get the latest version of the Google Cloud SDK, you can add the official repository:
$ curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/google-cloud-archive-keyring.gpg $ echo "deb [signed-by=/usr/share/keyrings/google-cloud-archive-keyring.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
Those are two separate jobs. The first fetches Google’s signing key and converts it into the binary format apt wants, storing it in its own file under keyrings. The second writes a source list entry that points at the repository and, through signed-by, names the exact key allowed to sign packages from it.
That pairing is the part worth understanding. Older guides tell you to run apt-key add, which drops a key into a single trusted store where it can validate packages from any repository at all. Scoping the key to one source is why the newer approach replaced it.
Update Package Lists Again:
After adding the repository, update the package lists again:
$ sudo apt update
Not optional. Apt has no idea the new source exists until it refreshes, and skipping this gives you a package-not-found error one step later.
Install the Google Cloud SDK:
Now, you can install the Google Cloud SDK:
$ sudo apt install google-cloud-sdk -y
Initialize the SDK:
After installation, you need to initialize the Google Cloud SDK. Run the following command and follow the prompts:
$ gcloud init
This command will ask you to log in with your Google Cloud account and configure your default project and region.
It opens a browser for the login. On a headless server there is no browser to open, which trips people up the first time, and the usual answer is to authenticate on a machine that has one or to use a service account key instead.
Service accounts are the right answer for anything automated in any case. A CI pipeline authenticating as a person is a pipeline that breaks the day that person leaves, and it carries far more permission than the job needs.
Something else worth knowing early: gcloud supports named configurations, so you can keep separate project, account and region settings side by side and switch between them. If you work across more than one project, setting those up now saves a lot of accidental deployments into the wrong place later.
Verify the Installation:
You can verify that the installation was successful by running:
$ gcloud version
It should display the installed Google Cloud SDK version
One consequence of the apt route is worth flagging. Because the package manager owns the install, gcloud components update will refuse to run and tell you to use apt instead. That is correct behaviour rather than a fault. Updates come through apt upgrade with everything else, and extra components like kubectl install as their own apt packages.
If you specifically want gcloud managing its own components, that is the tarball install, and the same SDK on a CentOS or RHEL box works the same way.
Running a Red Hat based system instead? The tarball route is different enough to be worth its own walkthrough: installing the Google Cloud SDK from source on CentOS 8.


