Sunday, November 9, 2014

linux - CentOS - Path shows /usr/local/bin but installer shows path error


I'm trying to install heroku on a virtual machine running CentOS. When I use


curl https://cli-assets.heroku.com/install.sh | sh
I get an error message saying that my path does not include /usr/local/bin. However, when I do echo $PATH I can see /usr/local/bin.




$ echo $PATH


/usr/local/bin:/local/home/sysadmin/.rbenv/plugins/ruby-build/bin:/local/home/sysadmin/.rbenv/shims:/local/home/sysadmin/.rbenv/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/local/home/sysadmin/.local/bin:/local/home/sysadmin/bin




What should I do to fix this?


Answer



That script requires root to install.
That means that when the script is running, it will be using root's environment and not yours. Root probably doesn't have /usr/local/bin in the path.


I am giving you the likely quick fix. This fix assumes that you have root permissions.. otherwise, you couldn't run this script in the first place.


The following suggestion will quite possibly make some *nix people crazy (because of sudo -i).


Open a terminal:


sudo -i                             #-- this logs you in as root.
export PATH=$PATH:/usr/local/bin #-- temporarily add the path you need

exit #-- DONT run anything else as root!

Good luck..


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...