Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to setup environment variables for application servers. For example: ORACLE_HOME, ORACLE_SID, JAVA_OPTS, CATALINA_BASE.

I know how to set system environment variables in Windows, but no ideas for Linux.

I start application servers manually, just assign and export them, then start application server (Tomcat, Oracle). But how to setup environment variables for Linux services, which start automatically during system startup?


I use Centos 5.4. server users shell is /bin/sh

share|improve this question
up vote 2 down vote accepted

As a best practice, follow the instructions provided by the vendor. These methods usually take care to limit the scope of the Environment variables, so that it doesn't overwrite environment variables used by unrelated products.

For instance, I've seen some shops that set or modify PATH, ORACLE_HOME, JAVA_HOME, JAVA_OPTS, etc. in /etc/profile, but this has the side effect of modifying the PATH for all users on your system, or setting a LD_LIBRARY_PATH which interferes with other pieces of software in many unexpected ways.

Also, multiple Oracle products may expect to find the environment script in an expected place (Like $ORACLE_HOME/app/oracle/product/10.2.0/server/bin/

share|improve this answer

This is one of those things where there are too many ways to do it, so you wind up having to do a lot of trial-and-error troubleshooting to make sure your way is working.

Personally I prefer to always work with the conventions your distribution is, so assuming you're doing this on a centos/rhel server that would mean putting your settings in something like /etc/profile.d/

share|improve this answer

Your Answer


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.