Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active April 25, 2022 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jniltinho/cdf990d011cd79b80b2097c0413337b8 to your computer and use it in GitHub Desktop.
Save jniltinho/cdf990d011cd79b80b2097c0413337b8 to your computer and use it in GitHub Desktop.
Install Google Cloud Cli
#!/bin/bash
## Install Google Cloud Cli
## https://tecadmin.net/how-to-install-google-cloud-sdk-on-ubuntu-20-04/
## https://cloud.google.com/sdk/docs/install#deb
## gcloud init --console-only
## gcloud auth login --no-launch-browser
## gcloud auth activate-service-account --key-file key-file.json
## echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
KUBECTL_VERSION=1.23.5
apt update
apt-get install -y unzip python python-dev git curl openssh-client ca-certificates gnupg
## Install kubectl
curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
mv kubectl /usr/bin/kubectl
chmod +x /usr/bin/kubectl
curl -sLO https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-382.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-cli-*-linux-x86_64.tar.gz
mv google-cloud-sdk /opt/
rm -f google-cloud-cli-*-linux-x86_64.tar.gz
cp /opt/google-cloud-sdk/completion.bash.inc /etc/bash_completion.d/
echo 'export PATH=$PATH:/opt/google-cloud-sdk/bin' >>/etc/profile
echo 'source /opt/google-cloud-sdk/path.bash.inc' >>/etc/profile
export PATH=$PATH:/opt/google-cloud-sdk/bin
source /opt/google-cloud-sdk/path.bash.inc
gcloud config set disable_usage_reporting true
gcloud --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment