Find out where Google Cloud SDK is installed - bash

I need to add the Google Cloud SDK in the PATH. So I need the path to where is installed. Is there any gcloud ... command which gives me this information?
If not I have to go through the symlink in which gcloud, etc.
Any cleaner solution for this problem?

The following command will give you the information you're looking for:
$ gcloud info --format="value(installation.sdk_root)"
/path/to/google-cloud-sdk/
You need to append /bin.
You also have lots of other paths available: config.paths.global_config_dir, installation.sdk_root, and so on. Look at the output of gcloud info --format=json for all available properties to query.

I used:
dirname $(which gcloud)
And worked like a charm

As of March 2022, the gcloud sdk link indicates you can have the SDK for client libraries Java, Python, Node.js, Ruby, .Net and Php.
In addition you can have the CLI too. If you have installed the CLI, part of the ( optional ) install process is to add the gcloud binary path to your PATH thus you can find it.
This script is called path.bash.inc, path.zsh.inc etc and depending on what your default shell is it will run the correct path.your_shell.inc file. If you have never run that, then it is possible your gcloud was installed in a directory that you lost track of.
If that is the case, then you have to simply run a "find" from the root
find / -name gcloud -type f -ls 2>/dev/zero
This contrasts with
AWS cli, that gets installed into system common PATH directory like /usr/local/bin on Mac
2 AZ cli, that gets installed using homebrew on Mac - under /opt/homebrew/bin path - which, if you used a Mac, already is in your Path.

Related

how can i install heroku in my kali linux operating system?

I cant install heroku in my kali linux operating system. how can i resolve this issue?
isn't it not possible to run heroku in kali linux?
when I have try to install, it show snap command not found.
Heroku no longer supports Snap installs:
Snap installs are no longer supported. Please use another install method below.
Since Kali is derived from Debian, you should be able to use the Debian / Ubuntu method (which doesn't auto-update) or the standalone tarball method (which does). You can also use the NPM / Yarn package if you prefer, though Heroku recommends against it.
All of these options require some amount of trust in Heroku. The first two pull a script down from the Internet and pipe it into sh, which always makes me a bit uneasy. I suspect they both request elevated privileges during the install process. Instead of piping the file directly in to sh as Heroku recommends, I suggest you download it and at least give it a quick read through the first time.
In any case, here is the command that Heroku recommends to install the standalone version:
curl https://cli-assets.heroku.com/install.sh | sh

Why /user/local/go isn't recognized as a Go SDK in GoLand

I'm trying to setup GoLand to use WSL 2 as in this guide: https://www.jetbrains.com/help/go/how-to-use-wsl-development-environment-in-product.html
I've installed Go in the Ubuntu distro following the linux instructions on the GoLang website, and go version prints outs the version I downloaded, so it appears that Go is working inside WSL.
So now I tried to create a new project in GoLand, and I'm getting errors, which appear to come from the fact that the SDK isn't loaded in GoLand. The guide doesn't offer much guidance on this, so I just tried to add a local SDK.
When I select /usr/local/go I get an error that it's not a valid SDK.
So I created the ~/go directory, and then updated my .zshrc file to export the GOPATH and GOROOT environment variables, even though they already showed up when I ran go env, doing this got them to show up on a simple env call.
But I'm still getting the invalid SDK error like above.
Is there a configuration step I'm missing that isn't spelled out in the guide? I came across this old post about creating symlinks to fake the expected directory structure. I haven't done this because it's a really old post, has comments that say this has been fixed, and seems like a really odd solution.
Support for Go SDK in WSL2 will be available in the next 2021.3 release, please see GO-10618.
October 2021 update.
2021.3 reaches Early Access Program at the moment. GoLand suggests selecting Go SDK on WSL2 mount if the location of the project is on WSL2 as well.
I experienced this on my Debian machine and I wasn't using WSL2. I found that the actual cause of the issue is that Goland is unable to read the directory /usr/local/go/bin due to inadequate permission.
A possible solution is to run the goland.sh script as root. The script can be found in the bin/goland.sh directory of the Goland IDE folder. Here is a simple command to do run Goland as the root
export HISTIGNORE='*sudo -S*' && echo "sudo-password-here" | sudo -S /absolute-path-to-goland.sh
export HISTIGNORE='*sudo -S*' tells bash history to ignore caching any command matching sudo -S* to bash history. This way, your sudo-password isn't saved into the bash-history file.
echo "sudo-password-here" | pipes your sudo password as input to the next command.
sudo -S tells bash to read input for password prompt from stdin, which has been provided through the echo command.
Alternatively, you can just install the latest version of Goland. Hopefully, it doesn't come with this bug

gCloud SDK failed to install in macOS behind corporate proxy

I am trying to install gcloud SDK while using a coporate network which works behind a proxy (and a VPN sometimes). I get proxy settings automatically using a pac.fcgi file (Automatic Proxy Configuration).
Now when I try to run ./install.sh in the terminal, I am constantly getting the following error
➜ google-cloud-sdk ./install.sh
Welcome to the Google Cloud SDK!
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>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:
gcloud config set disable_usage_reporting true
Do you want to help improve the Google Cloud SDK (Y/n)?
ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.
I found this SO question which was having the same issue, but their problem was related to ipv6. I already have ipv6 disabled (I can't even enable it) and I am using ethernet to connect to the network. Thus the answer is not useful to me.
I searched for proxy related info about installation and found this page. It asks for using a non-interactive installer instead and using gcloud command to set the proxy after installation. My problem is that I can't even install gcloud. I have tried with both interactive and non-interactive installers.
Any way I can install gcloud while being behind a corporate proxy.
PS: I am on macOS High Sierra and using zsh shell (already tried bash), in case it matters.
So, the problem was I was unable to set proxy before installation of gcloud. The installation of gcloud basically set the CLI in the path and installs some required components (core, bq, gsutil etc).
So what I did is I added the following lines in my .zshrc
source <PATH to gcloud sdk>/google-cloud-sdk/path.zsh.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.zsh.inc
or if you're using bash, add these lines in your .bashrc or .bash_profile
source <PATH to gcloud sdk>/google-cloud-sdk/path.bash.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.bash.inc
After that I restarted the terminal (or just run source ~/.zshrc or source ~/.bashrc or source ~/.bash_profile on terminal)
Now I was able to use gcloud commands. I ran gcloud init, set the proxy and then installed the required components using the following command -
gcloud components install core bq gsutil
And I installed gcloud without using the install.sh script.
PS: Run scutil --proxy to know the proxy settings set in your system.
For Windows 10 users who experience this issue. I installed the google SDK from the archived versions page. then used git bash to install using ./google-cloud-sdk/install.sh. then added in environment variable manually to PATH to use commands.

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Error while installing aws autoscaling command line tools on linux?

I am installing AWS Autoscaling tools on linux redhat, But unfortunately the as-cmd command is not working.
I am getting this error :
-bash: as-cmd: command not found
How to resolve the error ?
Any lead is appreciated
To Answer your question:
run below:
$ updatedb
$ locate as-cmd
This should provide you the path of the command like /usr/bin/as-cmd. Either you should use this complete path while running the command OR you need to update your $PATH variable to include this path. Google if you want to know how to update PATH variable.
Now, some suggestions:
You should not use as-cmd anymore. Please use AWS CLI. Here is the AWS CLI relevant autoscaling commands
The reason being, as-cmd is not maintained by Amazon anymore and all the old CLI features have been exported to AWS CLI. AWS CLI is a one stop shop for all the AWS Services unlike older CLIs where you had to install a separate CLI for individual services.
AWS CLI provides output in JSON format which is much more easier to parse.
BESIDES, You don't have to play with CLI for autoscaling. Now, you can do the same job via AWS Console.

Resources