1

Ok. So, I'm used to Ubuntu and CentOS more than redhat, so I'm hoping there's some obvious solution to this that I'm missing.

I've installed Anaconda (Python). I've placed it in:

/opt/anaconda3

I would like for myself and all users to be able to have the following in their paths:

/opt/anaconda3/bin

I have googled around and have gained a lot of conflicting information about how to "properly" accomplish my mission.

Stuff I have tried:

  1. Adding a bash script to /etc/profile.d
  2. Editing /etc/profile
  3. Editing /etc/bashrc
  4. Adding to root bashrc
  5. Editing user .bashrc

All edits involved some form of:

PATH=/opt/anaconda3/bin:$PATH

or

export PATH=/opt/anaconda3/bin:$PATH

Option 2 yielded the addition of /opt/anaconda3/bin to the path for multiple users, but after terminal restarts still did not run the commands within bin (i.e. conda install, ipython notebook, etc.)

Any ideas?

1

2 Answers 2

2

Create a file named (say) anaconda.sh in /etc/profile.d/ with the contents:

PATH=/opt/anaconda3/bin:$PATH

The trailing ".sh" is important, as that is the syntax that /etc/profile uses to search for files to include. Bash will read /etc/profile at login. If you want a current shell/terminal to pick up the change, just run . /etc/profile.d/anaconda.sh.

If you encounter situations where a non-interactive shell needs it, you're left with ~/.bashrc (unless the calling environment uses --rcfile to override that behavior).

0

Append the path to the file paths mentioned in the /etc/environment file.

This is loaded first before the local users directory .bashrc file is loaded so its the best place to set system wide vars.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .