LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   inserting entries into /etc/profile (https://www.linuxquestions.org/questions/linux-newbie-8/inserting-entries-into-etc-profile-651634/)

ggarrette 06-25-2008 02:02 PM

inserting entries into /etc/profile
 
For some ungodly reason I've been tasked with building a OpenNMS server on OpenSUSE 10.3 even though I've never touched Linux.... I'm following the directions from

.howtoforge.com/opennms_network_management, but am stuck on...

Setup Environment variable for java home. Insert the following entries in /etc/profile.

JAVA_HOME="/usr/lib/java"
export JAVA_HOME


How do I enter in the above statements into /etc/profile?

acid_kewpie 06-25-2008 02:07 PM

just open the file in whatever text editor you like as root and add them, then save the file.

jhilton 06-25-2008 02:09 PM

If I'm reading your question right then what you need is a text editor. If you're in the console then use either nano, vii or emacs. I myself perfer nano for just editting text and use emacs when I'm coding/testing.

Anyways once you're in the etc directory just type "nano profile" and take it from there.
Apologies if I misunderstood what you asked.

sonaul 06-25-2008 03:23 PM

Try either of the following methods:

method 1:
Fire the following command:
Quote:

vi /etc/profile.
Press "Enter" key
Then press "Escape" Key & then "I"
Then copy and paste the following into this file:
Quote:

JAVA_HOME="/usr/lib/java"
export JAVA_HOME
method 2:
Fire the following command:
Quote:

nano /etc/profile.
Then copy and paste the following into this file:
Quote:

JAVA_HOME="/usr/lib/java"
export JAVA_HOME

ggarrette 06-27-2008 09:02 AM

Does it matter where in that file I insert:

JAVA_HOME="/usr/lib/java"
export JAVA_HOME

And how I subsequently save the changes I made?

Thank you for your easy to follow instructions!

jschiwal 06-27-2008 09:24 AM

It really doesn't matter. These two lines are actually bash commands that get executed when the machine starts. However since you are using SuSE 10.2, edit /etc/profile.local instead. If the file doesn't exist, then create a new one with just those two lines.


The /etc/profile script will run the /etc/profile.local script.

b3nder 06-27-2008 03:18 PM

using the vi method to save the file you would need to do hit 'esc' after you type and then a :wq If you are in vi and want to exit without saving any changes, do a :q! .. also i would recommend making a test document and playing around with various commands if you plan on doing a lot of changes to text files using vi.. there are tons of guides, just google vi commands it should give a good guide.. best thing to do would be make a new document somewhere.. just type vi test.txt and play around in there so you don't mess anything up..

not really sure about exiting using nano -- i primary stick to vi as its easy to navigate once you get some commands committed to memory.

enjoy

Tinkster 06-27-2008 04:02 PM

And (depending on your distro) there may be the more
elegant option of sticking individual files into the
/etc/profile.d/ directory.


Cheers,
Tink


All times are GMT -5. The time now is 08:51 AM.