To make life easier you'll want an editor that you're comfortable with, and for people coming to Linux from Windows I strongly recommend NEdit (free software from the folks at Fermi Lab): you'll find that most commands are where you expect them to be, the mouse does what you'd expect it to do, and so on (which is not always the case with more ``hard core'' unix-style editors such as emacs or vi). In addition it has many powerful features that you can discover (or not, as you please) over time.
Now, all X GUI programs (such as NEdit) rely upon some ``library'' of shared code (or ``widget set'') for their basic graphical elements (menus, dialog boxes, etc.). There are many such widget sets for X. NEdit uses the popular Motif libraries, which produce quite a pleasing appearance - but Motif is a commercial product, and quite expensive. Is this a problem? Not really, since an excellent open source clone of Motif is available, called Lesstif.
So here's the plan: If you follow the steps here you will
(Caveat: I don't know the RedHat CDROM, but it's quite likely that there are rpm's - RedHat pre-made packages - for Lesstif and/or NEdit on the CD, in which case you don't have to do this the ``hard way'' that I'm describing. But you'll learn more this way. And it's not really hard. Your choice.)
If you plan to follow through, it may not be a bad idea to print out this tutorial now.
[KEY]'' means
press the key marked ``KEY'' - e.g. ``[Tab]'' means
press the Tab key.
Now get on the net and point your browser at the Lesstif site. If
you want to read about the Lesstif project, see their news and so
on, go in the front door at
www.lesstif.org. If you'd rather cut to the chase, go straight
to the download area at ftp.hungry.com. Look for the
latest stable release - as of this writing it was
lesstif-0.88.9.tar.gz.
You want to save this ``tarball'' to your hard drive. I suggest putting it in
/usr/src, a common location for source code packages. (The
Lesstif source package is 3133 Kb, but don't despair - if you have a 28.8kbps
modem or better it won't take forever to download.)
Now get to the command prompt in an xterm, and issue this sequence of commands:
cd /usr/src
ls -l
tar xvfz less[Tab]Tab will cause the shell to complete a
filename for you, if what you have typed already is enough to
identify a file uniquely. You should see a bunch of file
names zipping by as the extraction proceeds.
cd less[Tab]
lsless
REA[Tab].) Is there a file named ``configure'' in there?
Goody, that is our friend.
./configure --prefix=/usr/X11R6 --disable-debug--prefix=... bit arranges
things so that the libraries and stuff will be put under
/usr/X11R6 when you install them (instead of in the
default /usr/local). This is probably the best place
to have them, along with your other X libraries. The
--disable-debug says not to compile with the ``-g'' flag,
which includes debugging symbols. Leave out this bit if you want
the debugging symbols included - but most users probably don't need them,
and leaving them out makes the files quite a bit smaller. (In general it's a
good idea to run ./configure --help first, to
read about any special options to the compilation.)
make
make install
cd ..
rm -rf less[Tab][Enter]rm makes the removal recursive (takes out all
subdirectories), and the ``f'' forces it (no namby-pamby warnings;
we know what we're doing ;^).
rm less[Tab][Enter]
Point your browser at the NEdit site. The front door is at fnpspa.fnal.gov; the download area at ftp.fnal.gov. The current version is 5.0.2. From the ftp site get the source code tarball, nedit_source.tar.gz (511 Kb).
Again, save this to /usr/src, and, at the command
prompt in that directory, do:
ls
tar tvfz ned[Tab] | less
Comment: Let's just take a look inside (``t'' flag instead of ``x'' for
tar) this tarball (piping the listing into the pager, less) first. Aha, the
files are not all packed into one top-level directory, as with lesstif.
Type ``q'' to quit less. If we
explode the tarball in /usr/src it will be a bit awkward keeping
track of all the files. OK, we'll make a directory for it, move the tarball
in there, and work there.
mkdir nedit
mv nedit_[Tab] nedit
cd nedit
tar xvfz n[Tab]
ls
This time we've got a README and a Makefile, but no ``configure'' script. OK, let's take a look at README. Hmmm, seems like all we have to do is
make linux_nedit
The NEdit build takes about 5 minutes on a P133. See the little ``-lXm'' on the third last line of the screen output from the make command? That says that nedit has successfully linked with your new Motif (well, Lesstif) library. That was pretty painless.
Now, can we do ``make install''? Oh, ``No rule to make target `install' ''. Well, we'll have to put it in place manually. We remember that the README told us the binaries (executable files) would be in the ``source'' sub-directory. So
cd source
Comment: The ``install'' program will put nedit into
ls
install -s nedit /usr/local/bin/usr/local/bin, a reasonable place for ``home-made''
binaries. The ``-s'' flag means that install will strip the program
first, making it a bit smaller.
install -s nc /usr/local/bin
Comment: Likewise the NEdit client program (you may not
need this.)
Now what about documentation? We'll want to ensure that the manual pages are available. Weren't there some ``.man'' files back in our top-level nedit directory?
cd ..
ls
Comment: Yes. Now let's put them in a suitable place. Corresponding
to /usr/local/bin for local binaries is
/usr/local/man for manpages. Pages for ordinary user programs
generally go in man1, and are given a ``.1'' extension.
So:
cp nedit.man /usr/local/man/man1/nedit.1
cp nc.man /usr/local/man/man1/nc.1
...and check them out:
man nedit
man nc
Brilliant. Let's also take a peek at nedit.doc. Ah, it seems to be
a basic explanation of using the program, somewhat fuller than the
manpage. Where might it go? On many Linux systems /usr/doc
is the appropriate place. OK, so
mkdir /usr/doc/nedit
cp nedit.doc [Esc].
Comment: Eh? Well, in the bash shell, ``[Esc].''
pops onto the current command line the last term from the previous
command line. In this case we just made a certain directory, and
then immediately wanted to copy a file into it. So [Esc].
is our friend. And while we're at it
cp README [Esc].
Now clean up again:
cd ..
rm -rf nedit
Check out your new editor by typing ``nedit'' at the
command prompt in an xterm, or ``nedit filename'' to
open an existing file. You may want to type an ampersand after
such commands for launching GUI programs: ``nedit &''.
The ampersand ``backgrounds'' the job, or in other words gives you back
the command prompt right away (otherwise the command prompt is
``frozen'' until you exit the GUI program).
If NEdit doesn't come up for you, try typing the full path to the binary:
/usr/local/bin/nedit
If that works, we infer that the program is OK but
/usr/local/bin is not included in your PATH. You can fix
this temporarily by typing
export PATH=$PATH:/usr/local/bin
You can fix it permanently by putting this line into the file
.bashrc in your home directory.
You'll probably want to add NEdit to the menus in your X window
setup. If you're using the default RedHat window manager, copy
the text below into an editor (e.g. NEdit!), replace
``Group'' with the name of the menu in which you
want NEdit to appear, and save the file as
/etc/X11/wmconfig/nedit
nedit name "NEdit"
nedit description "GUI Editor"
nedit group Group
nedit exec "/usr/local/bin/nedit &"
Allin Cottrell (cottrell@ricardo.ecn.wfu.edu), November 8, 1998.