Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-25-2008, 02:02 PM   #1
LQ Newbie
Registered: Jun 2008
Posts: 14

Rep: Reputation: 0
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, but am stuck on...

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

export JAVA_HOME

How do I enter in the above statements into /etc/profile?
Old 06-25-2008, 02:07 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
just open the file in whatever text editor you like as root and add them, then save the file.
Old 06-25-2008, 02:09 PM   #3
LQ Newbie
Registered: Jun 2008
Posts: 29

Rep: Reputation: 15
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.
Old 06-25-2008, 03:23 PM   #4
LQ Newbie
Registered: Jan 2007
Posts: 5

Rep: Reputation: 0
Try either of the following methods:

method 1:
Fire the following command:
vi /etc/profile.
Press "Enter" key
Then press "Escape" Key & then "I"
Then copy and paste the following into this file:
export JAVA_HOME
method 2:
Fire the following command:
nano /etc/profile.
Then copy and paste the following into this file:
export JAVA_HOME
Old 06-27-2008, 09:02 AM   #5
LQ Newbie
Registered: Jun 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Does it matter where in that file I insert:

export JAVA_HOME

And how I subsequently save the changes I made?

Thank you for your easy to follow instructions!
Old 06-27-2008, 09:24 AM   #6
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
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.
Old 06-27-2008, 03:18 PM   #7
LQ Newbie
Registered: Jun 2008
Posts: 3

Rep: Reputation: 0
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.

Old 06-27-2008, 04:02 PM   #8
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to sort output at latest entries without disturbing the previous entries record nabmufti Programming 4 02-11-2008 11:36 PM
system profile vs user profile bonito SUSE / openSUSE 3 06-28-2006 01:02 PM
Inserting Manpages bhandu Linux - Software 2 03-20-2006 10:25 AM
[PHP/POSTGRESQL] Inserting entries Elijah Programming 0 07-09-2004 04:18 AM
Inserting modules wgodois Linux - Hardware 0 08-03-2003 09:37 AM

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration