Saturday, April 20, 2024
HomeTutorialsHow To Install and Configure Google Cloud SDK on Linux Desktop

How To Install and Configure Google Cloud SDK on Linux Desktop

Google Cloud SDK (Software Development Kit) is a cloud-based API system that you can use a command-line interface to build a virtual machine or environment for programming and software testing. It is built by Google and hosted on Google cloud storage. Previously, Google used to offer credit on free signup to google cloud SDK. But, I’m afraid that Google has turned that free features turned off. If you’re a software developer or tester, the Google Cloud SDK can be a convenient virtual system to release and test your codes. The cloud software development kit is available in the web version, but you can install the Google Cloud SDK on your Linux system for a better CLI-based interface.

Google Cloud SDK on Linux


The Google software development kit is available on the official Linux repository. You can install it through the repository method, Snap method, and script method. This post will see how to install the Google Cloud SDK on Ubuntu and Red Hat-based Linux systems and get started with it.

1. Install Google Cloud SDK on Debina/Ubuntu Linux


Installing the Google Cloud SDK services on a Ubuntu Linux system requires basic knowledge of terminal shell and the root privilege on your system. You can install it on your system using both the repository method and the Snap installation method.

Method 1: Install Google Software Development Kit via Repository


Google Cloud software development kit requires a local repository on the system. You will need to have the CA encryption certificate and the GNUPG on your Ubuntu system.

Step 1: Add Google Cloud Repository on Ubuntu Linux

First, make sure your system repository is updated. Then run the following command to add the CA and GNU Privacy Guard to your system. The command requires root privileges; make sure you’re the root user.

sudo apt update
sudo apt install apt-transport-https ca-certificates gnupg

install ca-certificates on Linux

After adding the CA-certificate to your Ubuntu system, you can now run the curl command given below to add the GPG key from the system’s Google Cloud repository.

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

Now, we need to add a personal package repository inside the system. You may run the following echo command on your terminal shell to add the repository.

echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

packages.cloud.google.com

Step 2: Install Google Software Development Kit

Till now, we’ve seen how to add a Google cloud SDK repository and the GNU privacy guard on our Ubuntu system. Now update the system repository to load the updated SDK repository files.

sudo apt update

Finally, you can now run the following aptitude command given below to install the SDK on your Ubuntu Linux system. The command will install a few PHP modules, MySQL library, java, and google cloud SDK files on your filesystem.

sudo apt install google-cloud-sdk

install Google sdk on Ubuntu

Method 2: Install Google Cloud SDK via Snap


As Snap is one of the popular tools to install packages on a Debian-based system, we can install google cloud SDK on our system using the Snap command. Before running a Snap command on your terminal shell, make sure that you have the Snap daemon installed on your Linux system. You can install it on your system by running the following commands.

sudo apt update
sudo apt install snapd

Then, run the following Snap command given below to install the Google Cloud SDK on your Linux system. The command will download and install the stable version of SDK from the official Linux repository. In the terminal screen, you will see the installation progress of the SDK on your system.

sudo snap install google-cloud-sdk --classic

snap install google SDK on ubuntu

2. Install Google Software Development Kit on Fedora Linux


If you have a Fedora workstation or a Red Hat-based Linux system, there are options to install the Google Cloud SDK on your machine through the repository and Snap store. Here, I’ll guide you on how you can install it on your Fedora and Red-based Linux system.

Method 1: Install Google Cloud SDK Via Linux Repository


First, you need to run the following command to add an SDK repository to your system. The command will check for the RPM-based GUN privacy guard key and add the repository guard key to your Linux system.

sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM

Google SDK GPGP Key on Fedora Linux

After adding the repository and the GNU key, you can now run the DNF command with root privilege on your terminal shell to install the Google Cloud SDK on your Fedora Linux.

sudo dnf install google-cloud-sdk

If you face any issues installing the SDK tool, you can try the YUM command given below.

sudo yum install google-cloud-sdk

Method 2: Install Google Cloud SDK Via Snapd on Fedora


Installing any packages on a Linux system through the Snap software daemon needs to have the daemon installed inside the system. If you need to install the Google Cloud SDK on your Fedora through Snapd, first, make sure that it is installed on your machine.

sudo dnf install snapd

Then create a soft link for the Snap daemon to run it in the system background.

sudo ln -s /var/lib/snapd/snap /snap

Finally, run the following Snap command on your terminal shell with root access to install the Google Cloud SDK on your Fedora Linux.

sudo snap install google-cloud-sdk --classic

3. Install Google Cloud SDK On Linux Through Installation Script


Till now, we’ve seen how you can install the Google Cloud SDK on a Linux machine through the Linux repository and the Snap store. Now, we’ll see how you can install the SDK on any Linux system through the installation script. You can execute the following method on Debian, Red Hat, SuSE Linux, Arch Linux, and other distributions for installing the Google Cloud software development kit.

Google Cloud SDK requires Python version 3 or higher. Before running any scripts, make sure that your system has Python 3.0 or higher.

python --version

Now, run the following cURL command given below to download the compressed version of the SDK tool on your filesystem. Usually, the below command will store the file inside the home directory.

Use the following command to download Google Cloud SDK for a 64-bit machine.

curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-332.0.0-linux-x86_64.tar.gz

Use the following command to download Google Cloud SDK for a 32-bit machine.

curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-332.0.0-linux-x86.tar.gz

check python and download SDK on LInux

When the download finishes, extract the compressed file through the tar command. Make sure you’re a root user on your machine.

tar -xvzf google-cloud-sdk-332.0.0-linux-x86_64.tar.gz

After extracting the compressed file, run the following install.sh script command to initialize the installation of Google Cloud SDK on your Linux system.

./google-cloud-sdk/install.sh

SDK install SH

After a successful installation, you can now run the following script command to start with the Google Cloud SDK tool on your terminal shell.

./google-cloud-sdk/bin/gcloud init

Get Started with Google Cloud SDK


If you already have a Google cloud SDK account, you can log in to your account with your Gmail account through a web browser. But, as we are trying to use the Google Cloud SDK through the CLI, we can run an SDK login session through the terminal shell by running the following gcloud command.

sudo gcloud init

The above command will check your network connection and open a login session to login into the SDK account.

sudo gcloud init

If you want to open the Google Cloud SDK console view on your Linux system, run the following command on your terminal shell. When the network checking finishes, it will provide an URL that you can open through a web browser.

gcloud init --console-only

gcloud init --console-only

Final Words


In the era of computing, everything is going cloud. As a Linux software tester, I need to run and check applications on various distributions. Using a cloud-based ready-to-go integrated system can be a convenient solution for the people like me while switching machines are time-consuming and difficult.

In the entire post, I’ve described three different methods of installing the Google Cloud SDK on a Linux system and how to get started with it. Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like It!

Trending Now