Cps Install
Cps Install
Cps Install
30
Installation Guide
R. B. Herrmann
28 November 2004
1
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
1 Introduction..............................................................................4
1.1 CDROM distribution........................................................4
2 Installation on UNIX/Linux/MacOS–X........................................6
2.1 Compilers........................................................................6
Solaris..........................................................................6
Linux............................................................................6
MacOS–X....................................................................6
FTP..............................................................................6
CDROM.......................................................................7
2.4 Compiling........................................................................7
Changing PATH............................................................9
2.5 Documentation................................................................9
WEB...........................................................................11
CDROM......................................................................11
2
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Start Cygwin...............................................................25
Keyboard...................................................................30
Copy/Paste................................................................30
Graphics....................................................................31
3.9 Documentation..............................................................32
3.11 Printing..........................................................................32
3
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
1 Introduction
This document describes the installation of Version 3.30 of the Computer Programs in
Seismology package created by R. B. Herrmann of Saint Louis University. This
installation has been tested for the Solaris operating system running on a Sun Sparc, on
Linux and Windows on PC platforms and on Apple’s MacOS–X system.
Installation Files
There are two ways of distributing this software – a special CDROM or Internet
download using ftp.
In addition, the CDROM distribution has precompiled binaries for several operating
systems. If the CDROM drive is “D:”, these binaries are
This will unpack the binaries and documentation into the directories
PROGRAMS.330/bin
PROGRAMS.330/DOC
The bin folder contains the executable binaries and shell scripts. The DOC folder is split
into sub-folders that contain tutorials in PDF format.
The binaries should work on the various systems. If they do not, unpack the file
NP330.tgz and compile everything following the instructions of Sections 3 or 4.
4
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
http://www.eas.slu.edu/People/RBHerrmann/ComputerPrograms.html
This will lead you to the ftp area for download. You will be able to get the following
5
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
2 Installation on UNIX/Linux/MacOS–X
2.1 Compilers
Solaris
Either the Sun cc/f77 suite is required or the freely available gcc/g77 compilers.
Precompiled gcc/g77 binary executables of these compilers are available for free at the
site:
http://sunfreeware.com
Just select the version corresponding to your operating system and architecture. There
are also other interesting software packages there too.
Linux
You will need the gcc/g77 compilers and the X11 programming support files.
MacOS–X
You will require the gcc/g77 compilers. You will have to search the web for them. You
may have to do a Web search for the pattern ‘g77 Mac OSX’. One such link is
http://hpc.sourceforge.net
FTP
The most recent version of the Computer Programs in Seismology package will always
be available for ftp download from the site:
ftp://ftp.eas.slu.edu/pub/rbh/PROGRAMS.330
In this directory you will find files ending in “.Z” or “.tgz” which are compressed “tar” files
in either “compress” or “gzip” formats. The gzip’d files are smaller. You only require one
of the two formats.
6
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
CDROM
This is the distribution on this CDROM. The are stored in the directory/folder “ /usr” in
the file “NP330.tgz”
sh or bash csh
for i in *.Z foreach i ( *.Z)
do zcat $i | tar xf –
zcat $i | tar xf – end
done
sh or bash csh
for i in *.tgz foreach i ( *.tgz)
do gunzip –c $i | tar xf –
gunzip –c $i | tar xf – end
done
Eventually you may remove the “.Z” or “.tgz” files to save space. You will not require
these any more.
2.4 Compiling
Note that in the example below “rbh>” is the shell prompt indicating that you are in the
“rbh” directory. If your directory name is different, the prompt will be different.
Commands for you to type are indicated in bold, such as “cd”.
7
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
When the compilation is done, the executables will be in the “ /bin” directory and the
libraries in “/lib”.
8
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Changing PATH
In order to use the programs you must change the PATH environment parameter. First
determine the name of the SHELL that you are using.
/bin/sh
Edit “/home/rbh/.profile” to add the following lines after the last reference to PATH.
PATH=$PATH:/home/rbh/PROGRAMS.330/bin
export PATH
/bin/bash
PATH=$PATH:/home/rbh/PROGRAMS.330/bin
export PATH
/bin/csh
Edit “/home/rbh/.cshrc” or equivalently “~/.cshrc” to add the following lines after the last
reference to PATH.
2.5 Documentation
Documentation is in the directory DOC in both PDF and PS formats.
You are now ready to use Computer Programs in Seismology! Have Fun
9
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
WEB
Use the browser to go to the Cygwin website at http://www.cygwin.com.
Start setup.exe from the control panel or from the run option of windows.
CDROM
Cygwin is on the CDROM in the “ usr” folder. For example if the CDROM drive is “D:”,
then you will want to run the program D:\usr\setup.exe. In the control panel, you need
only to click on the setup icon
10
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
11
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
The first thing to do is to start the Cygwin Setup. You will see the following:
12
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
We now indicate the source of the installation: For the distribution CD, we will use “Install
from Local Directory”.
13
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
14
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
The program asks for the local package directory. If the CDROM is on the “D:” drive,
then modify the next screen to use “D:\usr\cygwin.dist”.
Cygwin will now provide a menu by which you can install everything or just part of the
distribution. To modify a selection, just click on the Default entry. If you click on the
Default entry under the upper level category All, then you will get the entire
distribution. This is the simplest way to install. If you do not have enough disk
space for the entire distribution, follow instructions below to select the minimum
necessary files.
15
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
16
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Open the category “Devel” by clicking on the “+” to the left of the name “Devel”.
A long list of all the packages in the Devel category will open.
17
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Scroll the window down until you see “gcc” in the Package column.
Select the “gcc” package for installation by single clicking next to the word “Skip” across
from “gcc”.
When properly selected for installation, it will display the version number of the gcc
package it will install.
Similarly, select the “gcc-g77” package for installation by clicking next to “Skip”.
18
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Scroll the window down some more until you see the package “gdb”.
Select the “gdb” package for installation by clicking the word “Skip” once to change the
display to the package version number.
19
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
20
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Scroll the window down farther until the “Editors” category appears on the left.
Open the “Editors” category by clicking the “+” next to the category name.
Select the package “vim” for installation. If you wish a graphical editor, select “nedit.”
“ed” is useful for editing within shell scripts.
21
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
22
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
When the installation has finished, select “Finish” to exit the setup program.
A Cygwin icon will appear on the Desktop and in the Start menu Programs tab.
Note: The entire Cygwin package is available from the official Cygwin web page
http://www.cygwin.com. If you wish to add more programs or to update from the internet,
if you have a high speed connection, repeat the “setup” procedure.
23
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Start Cygwin
At this point you should have a Cygwin icon on your desktop. Click this icon. A terminal
window will appear. We need to modify some startup information for Cygwin to allow it
to find all the programs we want to use.
Edit the file “/etc/profile” so that the search PATH has “/usr/X11R6/bin” first. This line at
the beginning of the file must look like:
PATH=”/usr/X11R6/bin:/usr/local/bin:/usr/bin:/bin:$PATH”
export PATH
The simplest is to edit the file /etc/passwd. Look for the entry for you user name, e.g.,
mkh:unused_by_nt/2000/xp:1009:513:mkh,U-FARLEY\mkh,S-1-5-21-632854848-
2332866997-1805960406-1009:/cygdrive/c/Documents and Settings/mkh:/bin/bash
or something like this. Then enclose the PATH by double quotes:
mkh:unused_by_nt/2000/xp:1009:513:mkh,U-FARLEY\mkh,S-1-5-21-632854848-
2332866997-1805960406-1009:/cygdrive/c/”Documents and Settings”/mkh:/bin/bash
The other approach is to keep all CYGWIN stuff away from the normal WINDOWS files
by placing the user directly under the CYGWIN tree. This is done by ensuring that the
user HOME directory is located directly under the CYGWIN installation, specifically that
there be a
/home/Owner
directory. If /home or /home/Owner do not exist when you log in, create it using the
command
mkdir /home
24
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
mkdir /home/Owner
Now modify the Owner entry in /etc/passwd to read as
Guest:unused_by_nt/2000/xp:501:513:U-FARLEY\Guest,S-1-5-21-632854848-
2332866997-1805960406-501:/home/Guest:/bin/bash
mkh:unused_by_nt/2000/xp:1009:513:mkh,U-FARLEY\mkh,S-1-5-21-632854848-
2332866997-1805960406-1009:/home/mkh:/bin/bash
Owner:unused_by_nt/2000/xp:1003:513:rbh,U-FARLEY\Owner,S-1-5-21-632854848-
2332866997-1805960406-1003:/home/Owner:/bin/bash
You only have to worry about the bold faced name fo the login directory. Note that there
are no spaces.
Now exit by typing exit and then restart the CYGWIN program.
cd
Now edit the “.bash_profile” file there so that it looks like the following:
export PATH=$PATH:/cygdrive/c/usr/PROGRAMS.330/bin:
In this example, the PROGRAMS are installed on the C: drive in a folder called “ usr”.
Cygwin defines the Windows C: drive in a UNIX-like manner through the file path
“/cygdrive/c”. To see the Cygwin view of the file system, enter the command “df”.
cd
cp /etc/X11/xinit/xinitrc .xinitrc
Now edit the “.xinitrc” file by commenting out the reference to the xterm command at the
end and invoking the “wmaker” window manager. The last line should look like:
wmaker
#exec xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash -l
which is obtained by commenting the xterm line with the “#” symbol and adding the
“wmaker” command.
25
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
There are two choices here. Either you can start up the GNUstep window manager or
you can start just two terminal session without the clutter of an additional window
manager.
No Window Mananger:
This is the simplest to start. However to make it easier to use edit the following file:
/usr/X11R6/bin/startxwin.sh
Then find the line that starts with “xterm” and duplicate the line. This last lines of this
shell script should then appear as follows when you are done:
xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash -l &
xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash -l &
#
# Startup the twm window manager.
# WARNING: Do not use an external window manager in conjunction with
# the ``-multiwindow'' command-line parameter for XWin. Doing so
# would start two window managers, which is never supposed to happen.
#
# twm &
# Set a background color. Only needed when not using -multwindow for XWin.
To start the X11 session from your first DOS command terminal, just enter the command
26
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
startxwin.sh &
Two “xterm” sessions will appear from which you can start any Computer Programs in
Seismology program, even one using X22 graphics.
GNUstep Session:
xinit
The computer will spend some time copying window manager files to your login
directory. When the window manager starts, just hit the mouse buttons. You will see a
menu appear.
Now start an Xterm session. From one of the menu items you can start an xterm
terminal session. You can also exit or switch to another window. Not all of the menu
options are implemented.
At this point you can “ssh” to other computers if you have access to them. You can start
other programs from within the X11 environment:
27
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
cd
cp D:/usr/rbhenv.tgz | tar xf –
if D: is the name of the CD drive used. Of course please examine these files. You will
see that I have implemented some simple aliases that you may wish to use.
28
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
cd /usr/share/doc
To answer specific questions go to the Cygwin website http://www.cygwin.com at which
you will find a link to a User's Guide under documentation.
Since the commands are those of Linux systems, a book on Linux or the bash shell
would be useful.
Keyboard
The bash shell uses certain characters: # ` ~ & % / \ { } | that may not be directly
available on non-US keyboards. Windows knows about your keyboard, but X11 does
not. This means that a symbol typed under Windows may not appear the same under
X11.
Copy/Paste
There may be times that you wish to copy text between Windows and X11. You will not
be able to copy graphics images though. Text copying can be done as follows:
You copy text to the clipboard in Windows with Ctrl+C. You then paste that in X11 with
either a middle mouse button click or via a menu in the current application (if it has a
Paste menu item).
You copy text in X11 by highlighting it and, optionally, clicking the Copy button in a menu
(if the application has a Copy menu item). Leave the text highlighted just to be sure. To
paste that text in Windows, press Ctrl+V.
The difficulty with this is that the lines of text files in Windows are terminated by a
carriage return (CR) and a line feed (LF), but by just a line feed (LF) in UNIX and the
way that we set up Cygwin. It is better to do the following:
On Windows, save the text as a text file under SAVE AS. Then from within Cygwin run
the command “dos2unix textfile”. This program replaces the CR LF combination by just
a LF.
On X11, save the text as a textfile and then run the command “unix2dos textfile”.
29
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
Graphics
The ImageMagick package (which requires GhostScript) permits conversion of graphics
formats. For example, the Computer Programs in Seismology package graphics
consists of a binary graphics metafile, which can be converted to Encapsulated
PostScript. If this CALPLOT file is called SHWMOD96.PLT, then I can create a portable
network graphics file (PNG) for insertion into MS Office documents or web pages using
the commands:
In another instance, Norton Firewall software prohibited the use of ssh and scp. Either
turn the Norton Firewall off temporarily or learn enough to tell it that ssh and scp packets
can be transferred.
cd /cygdrive/c
mkdir usr
Now copy the distribution from the CD and unpack it. If the CDROM is on the D: drive
just drag or copy/paste “D:/usr/NP330.tgz” to the “usr” folder.
cd /cygdrive/c/usr
gunzip –c NP330.tgz | tar xf –
This will create the folder PROGRAMS.330. To compile and install the programs we
follow the procedure similar to that for the UNIX/Linux/MacOS–X systems:
cd PROGRAMS.330
./Setup CYGWIN
./C
30
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
If your SHELL path is properly set, you will be able to do the following:
which plotxvig
To test the distribution, I would do the following.
cd PROGRAMS.330/CALPLOT/testc
plotxvig < PLTTST.1
This will draw a set of colored circles. Now try
make new
new
This test program uses the cursor and tests some of the CALPLOT library calls.
3.9 Documentation
To view the documentation you can use your Adobe acroread program or the Cygwin
“gv” to access the pdf files in the folders that end with “ .pdf” in Computer Programs in
Seismology. All documentation is within the PROGRAMS.330/DOC folder.
export PATH=:../bin:$PATH
Note the blanks between Command and Files and between Adaptec and Shared. These
will cause the export command to fail. The remedy is to use the following in SHELL
scripts:
export PATH=:../bin:”$PATH”
The double quotes permit the original PATH variable to be used in its entirety.
3.11 Printing
Single page graphics plots in Computer Programs in Seismology are output in
encapsulated postscript using the commands
31
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
The PNG file plot.png can then be included in Powerpoint of MS Word files.
If it is necessary to print something, I would do the following. First create a PostScript file
using plotnps for CALPLOT graphics or a2ps for text files. Then go to the Windows Start
and select ghostgum/ghostview to open the EPS file and then to print. This is the
preferred way to print anything since Windows knows about attached printers.
32
INSTALLATION OF COMPUTER PROGRAMS IN SEISMOLOGY – 3.30
rbh> cd GMPROTO
This will create prototype directories for high frequency regression studies. For
information on the installation please read the DOC/Tutorial.pdf/gmdmot.pdf. You must
have PROGRAMS.330 already installed. You will run the script MAKELOCAL which will
place a copy of the programs and data directories for your data set. This type of
installation was chosen since we often use this same set of tools to study ground motion
data sets from different regions.
33