Google Cloud SDK is a pack of command-line tools that users can install to interact with the Google Cloud Platform directly. The software works on most Linux operating systems, provided that the Linux system has access to Python2. In this tutorial, we’ll go over all of the ways you can get Google Cloud SDK on Linux.
Arch Linux instructions
Arch Linux doesn’t officially carry the Google Cloud SDK in their package repositories. Instead, if you’d like to get the SDK up and running on your Arch-based PC for development, you’ll have to resort to using the Arch Linux User Repository instead.
Interacting with the AUR on Arch Linux requires installing some packages. These packages are Git (for downloading packages from the internet) and Base-devel (needed to compile programs from source, install AUR programs, etc.) Getting these packages working on Arch is simple. To do it, open up a terminal window using Ctrl + Shift + T or Ctrl + Alt + T on the keyboard. Then, use the Pacman package manager to load everything up.
sudo pacman -S git base-devel
Following the successful installation of the Git and Base-devel packages, it’s time to download the Trizen package build from the AUR. Without Trizen, installing the Cloud SDK is very tedious, and you’ll have to install dependencies by hand. Using the git clone command, download the latest release of Trizen.
git clone https://aur.archlinux.org/trizen.git
Use the CD command and move the terminal session into the newly created “trizen” directory.
cd trizen
Inside of the “Trizen” directory, run the makepkg command to generate and install Trizen onto Arch Linux.
makepkg -sri
Finally, use the Trizen AUR package installer to load up Google Cloud SDK on Arch Linux quickly.
trizen -S google-cloud-sdk
Once set up, access the SDK with:
gcloud init
Are you having trouble using the AUR release of Google Cloud SDK on your Arch Linux computer? Feel free to try out the Snap version of the software instead. It’s officially updated and handled by Google, so it’s sure to contain fewer bugs and problems than an unofficial AUR build!
Snap package instructions
Google has uploaded the Cloud SDK toolkit to the Ubuntu Snap store for easy installation. So, if you have to have the latest Google Cloud tools for your projects, but don’t want to deal with downloading everything, and dealing with the setup process on Linux, this is the way to go.
Using Snap packages on Linux is supported by most modern Linux operating systems, like Ubuntu, Debian, Arch Linux, Fedora, OpenSUSE, Gentoo, and others. However, a lot of the distributions that support Snaps don’t do so out of the box, so before attempting to get the Cloud SDK Snap installed, you must enable the Snap runtime on your Linux system.
Enabling the Snap runtime on Linux is quite easy. To do it, open up a terminal window, install the “snapd” package, and enable “snapd.socket” with systemctl as root.
Note: unsure about how to set up the Snap runtime on your Linux system? We can help! Check out this in-depth article all about how to set up Snapd on Linux. Alternatively, try installing Ubuntu Linux, as it has Snaps enabled out of the box!
Once the Snap runtime is up and running on the system, use the snap install command to install the latest Google Cloud SDK.
sudo snap install google-cloud-sdk --channel=stable/latest --classic
Access the SDK with:
gcloud init
Be sure to run snap refresh
if you need to update the SDK.
Generic Linux instructions
Aside from being available on the Arch Linux AUR and as a Snap package, Google Cloud SDK can be quickly installed to any Linux system by downloading a Tar archive directly from Google’s quickstart page.
There are two versions of the Cloud SDK available for download on Linux: the 32-bit version and the 64-bit version. To start the installation, open up a terminal window by pressing Ctrl + Shift + T or Ctrl + Alt + T on the keyboard. Then, use the curl command to get the latest release.
Note: you may need to install the Curl app before using it to download with the command below.
64-bit
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-251.0.0-linux-x86_64.tar.gz
32-bit
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-251.0.0-linux-x86.tar.gz
After the Google Cloud SDK TarGZ file is done downloading to your Linux system, use the tar command to extract the contents of the archive.
tar zxvf google-cloud-sdk-251.0.0-linux-x86_64.tar.gz
Or
tar zxvf google-cloud-sdk-251.0.0-linux-x86.tar.gz
Running the extraction command should create a new folder in your home directory (~) labeled “google-cloud-sdk.” Using the CD command, move into that directory and start up the installation script.
cd google-cloud-sdk ./google-cloud-sdk/install.sh
The installation script is quick and will get the SDK set up thoroughly on your Linux system. When it’s done, access it with:
gcloud init