sudo apt install google-cloud-sdk
Or
sudo snap install google-cloud-sdk --classic
Initialize Cloud
This authorizes Cloud SDK tools to use your Google account credentials to access Google Cloud and manage it.
sudo gcloud init
If you want to login only using console
gcloud init --console-only
gcloud auth login --no-launch-browser
gcloud auth activate-service-account --key-file <path to key file>
To remove account:
gcloud auth revoke serviceaccount@testproject.iam.gserviceaccount.com
And run,
gcloud auth list
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service_accont_key_file.json