To install the Google Cloud SDK on CentOS 8, you can follow these steps:
Update the Package Repository:
Before installing any software, it’s a good practice to ensure that your package repository is up to date. Open a terminal and run the following command:
$ sudo dnf update Dependencies resolved. Nothing to do. Complete!
Download and Install the Google Cloud SDK:
You can download and install the Google Cloud SDK using the following commands:
# Create a directory for the installation (optional)
mkdir -p ~/Downloads
cd ~/Downloads
# Download the Google Cloud SDK installer
$ curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-447.0.0-linux-x86_64.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 179M 100 179M 0 0 3516k 0 0:00:52 0:00:52 --:--:-- 3594k
# Extract the downloaded archive
tar zxvf google-cloud-sdk-447.0.0-linux-x86_64.tar.gz
# Run the installer
$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud CLI!
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:
gcloud config set disable_usage_reporting false
Do you want to help improve the Google Cloud CLI (y/N)? y
Replace the URL in the curl command with the latest version’s URL if a new version is available. You can find the latest version on the Google Cloud SDK Downloads page.
Initialize the Google Cloud SDK:
After installing, you’ll need to initialize the Google Cloud SDK by running the following command:
$ gcloud init
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)? y
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/.....
Enter authorization code: mPj9OzRzZLcbSrcrvzaBKOcrrhLZrObG-adhUA2
You are logged in as: [sample@gmail.com].
Pick cloud project to use:
[1] project-3311
[2] Enter a project ID
[3] Create a new project
Please enter numeric choice or text value (must exactly match list item): 1
Your current project has been set to: [kindy-34411].
Do you want to configure a default Compute Region and Zone? (Y/n)? y
This command will guide you through the setup process, including authentication and configuration.
(Optional) Install Additional Components:
Depending on your specific needs, you may want to install additional components or update the SDK. You can use the gcloud components command to manage components. For example, to install the kubectl command for Kubernetes, you can run:
$ gcloud components install kubectl Your current Google Cloud CLI version is: 447.0.0 Installing components from version: 447.0.0 ┌─────────────────────────────────────────────┐ │ These components will be installed. │ ├────────────────────────┬─────────┬──────────┤ │ Name │ Version │ Size │ ├────────────────────────┼─────────┼──────────┤ │ gke-gcloud-auth-plugin │ 0.5.6 │ 7.9 MiB │ │ kubectl │ 1.27.5 │ 98.0 MiB │ │ kubectl │ 1.27.5 │ < 1 MiB │ └────────────────────────┴─────────┴──────────┘ For the latest full release notes, please visit: https://cloud.google.com/sdk/release_notes Do you want to continue (Y/n)? y ╔════════════════════════════════════════════════════════════╗ ╠═ Creating update staging area ═╣ ╠════════════════════════════════════════════════════════════╣ ╠═ Installing: gke-gcloud-auth-plugin ═╣ ╠════════════════════════════════════════════════════════════╣ ╠═ Installing: gke-gcloud-auth-plugin ═╣ ╠════════════════════════════════════════════════════════════╣ ╠═ Installing: kubectl ═╣ ╠════════════════════════════════════════════════════════════╣ ╠═ Installing: kubectl ═╣ ╠════════════════════════════════════════════════════════════╣ ╠═ Creating backup and activating new installation ═╣ ╚════════════════════════════════════════════════════════════╝ Performing post processing steps...done. Update done!
You can also update the SDK and its components with:
$ gcloud components update Beginning update. This process may take several minutes. All components are up to date.
Verify Installation:
You can verify that the Google Cloud SDK is correctly installed by running:
$ gcloud --version Google Cloud SDK 447.0.0 bq 2.0.98 bundled-python3-unix 3.9.16 core 2023.09.15 gcloud-crc32c 1.0.0 gke-gcloud-auth-plugin 0.5.6 gsutil 5.25 kubectl 1.27.5
This should display the installed version of the Google Cloud SDK.
Now you have the Google Cloud SDK installed on your CentOS 8 system, and you can use it to interact with Google Cloud Platform services and manage your cloud resources.