Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I recently compiled Ruby Enterprise Edition (REE) on an Ubuntu 8.04 server.

I would like to update my PATH to ensure this new version of Ruby (found in /opt/ruby_ee/bin) supersedes the older version in /usr/local/bin. (I still want the old version around, though.)

I would like these PATH changes to affect all users and crontabs.

Attempted Solution #1:

The REE documentation recommends placing the REE bin folder at the beginning of the global PATH in /etc/environment. I altered the PATH in this file to read:

PATH="/opt/ruby_ee/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

This did not affect my PATH at all.

Attempted Solution #2:

Next I followed these instructions and updated the PATH setting in /etc/login.defs and /etc/crontab. (I did not change /etc/sudoers.)

This didn't affect my PATH either, even after logging out and rebooting the server.

Other information:

  • I seem to be having the same problem described here.
  • I'm testing using the commands "echo $PATH" and "ruby -v".
  • My shell is bash. My .bashrc doesn't override my PATH.
  • Yes, I have heard of the Ruby Version Manager project. ;)
share|improve this question

2 Answers 2

up vote 4 down vote accepted

Have you tried altering the default bashrc? This should be located in either /etc/bashrc or /etc/bash.bashrc (I think it's the second one in Ubuntu). Then in your home directory, make sure your .bash_profile includes:

if [ -f /etc/bash.bashrc ]; then
    . /etc/bash.bashrc
fi

This will make sure that the variables defined system-wide are read into the user's shell. This if-statement should be included by default in the .bash_profile created when you adduser (I know it is in RHEL).

share|improve this answer
    
Adding PATH="/opt/ruby_ee/bin:$PATH" to /etc/bash.bashrc did the trick! –  Wally Glutton Mar 6 '11 at 3:53
    
Thank you kindly. –  Wally Glutton Mar 6 '11 at 3:55

Just to be clear, /etc/environment isn't loaded until you open a new shell / log in again.
Did you log-off and on?

share|improve this answer
    
I'm ssh'ing into the server. I have logged in and out a few times. I even restarted the server. :) –  Wally Glutton Mar 6 '11 at 3:47
    
`/etc/environment isn't read by the shell. –  Dennis Williamson Mar 6 '11 at 5:22
    
According to the Ubuntu help pages, it is. help.ubuntu.com/community/EnvironmentVariables –  Bart De Vos Mar 6 '11 at 9:28
    
This was the confusing part for me, the fact that the Ubuntu docs claim that /etc/environment is a root PATH source. Also, the fix I link to in the second attempted solution shows that changing this file works for some Ubuntu users. –  Wally Glutton Mar 6 '11 at 18:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.