1

I have installed java 8 on my bluehost VPS. I have followed http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/ instructions .

In order to add directories to PATH variable I have added

PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin
JAVA_HOME=/opt/jdk1.8.0_45
JRE_HOME=/opt/jdk1.8.0_45/jre

to etc/environment file.

After that I can't push upgrades to my git repository and when I login via ssh I can't run unix command.

My server OS is CentOS and its 64bit

EDIT :


Error shown in git :

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to [email protected]:/home/darmanjo/darmanjoo.git

bash: git-receive-pack: command not found

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

SSH Problem :

login as: root
[email protected]'s password:
Last login: Tue Apr 21 15:26:53 2015 from 109-110-182-162-dynamic.shabdiznet.com
-bash: id: command not found
-bash: tty: command not found
[email protected] [~]# ls
-bash: ls: command not found
[email protected] [~]#

Also my echo $PATH shows :

/usr/local/sbin:/usr/sbin:/sbin:$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin:/root/bin
5
  • What is the problem you are having? Apr 21, 2015 at 16:49
  • The way your question is written it sounds as if you COULD have performed these tasks BEFORE you made these changes to PATH. In particular, your use of "after that". Also, if you're logging into a unix (linux) system, what "unix command" are you referring to - ANY command? The shell built-ins? Anything BUT the shell built-ins?
    – Richard T
    Apr 21, 2015 at 17:00
  • @MichaelHampton I can't run unix command : ls. also I can't push my git upgrades , Error shown : bash: git-receive-pack: command not found fatal: Could not read from remote repository.
    – user111426
    Apr 21, 2015 at 17:04
  • @MichaelHampton Please see my edits. thanks.
    – user111426
    Apr 21, 2015 at 17:08
  • VPS hoster limitation ? Ask there help
    – yagmoth555
    Apr 21, 2015 at 18:36

1 Answer 1

2

You can't use variable expansion in /etc/environment (which is why you see an unexpanded $PATH in the output from echo $PATH). /etc/environment is read by the pam_env module not a shell script so just simple assignments.

You probably want to add this stuff to /etc/profile or add a file under /etc/profile.d/.

See https://serverfault.com/questions/165342/can-you-use-variables-when-editing-etc-environment-in-ubuntu-10-04 for more details.

You must log in to answer this question.