2

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?

UPD

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

2 Answers 2

2

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/oracle_env.sh).

5

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/oracle.sh.

You must log in to answer this question.

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