PVM Installation Guide
---------------------------------
Steps
1) This manual is for Fedora 2, Fedora 3. It may work for others if you identify the
platform and set variables accordingly.
To Get Latest version of Fedora
http://fedora.redhat.com/download
2) Get PVM
PVM comes with Fedora but you have to choose the custom settings and select pvm option
from the Engineering & Scientific Utilities.
If you forgot to install PVM when you installed the system, download it from
http://download.fedora.redhat.com/pub/fedora/linux/core/updates/3/
Choose the latest version of PVM. The above link is the update website as of Fedora 3.
It will work in Fedora 2 as well.
Once downloaded install the package using rpm utility
$ rpm -Uvh pvm-3.4.5-2_FC3.i386.rpm
3) Setup Environment Variables
There are 4 environmental variables that we need to setup for PVM to work properly.
PVM_ROOT - is the directory where PVM is installed
My PVM root is /usr/share/pvm3
PVM_ARCH - stands for PVM Architecture. It is usually the value of the directory name
inside the lib directory of the PVM installation
$ ls /usr/share/pvm3/lib/
will list the arch value
My PVM arch is LINUXI386
PVM_RSH - represents the path of rsh utility. As rsh is insecure, ssh does just the job,
so PVM_RSH will be set to the path of ssh.
My PVM_RSH is /usr/bin/ssh
PVM_TMP - when PVM is running it keeps its log information in the temp files inside the
PVM_TMP directory, which by default is /tmp. If you don't have write permission,
if your folder doesn't exist or you want to store in a different directory, set the
value.
My PVM temp directory is /tmp
To update environment variables, you need to update at these two files:
a) /etc/profile - is the file that has environment variables for all users.
b) ~/.bashrc - where bash can be replace by your shell name.
We will declare the variables in profile, and again repeat the declaration in .bashrc
The reason we do it is because, when you try to add the host from pvm, it seems to loose
the global environmental variables.
append these lines at the end of the above files.
Assumption PVM base directory is /usr/share/pvm3, and the system is LINUX 386.
PVM_ROOT=/usr/share/pvm3
PVM_ARCH="LINUXI386"
PVM_RSH=/usr/bin/ssh
PVM_TMP=/tmp
#putting pvm bin to the path
PATH=$PVM_ROOT/bin:$PATH
#make these variables available for use in the shell
export PVM_ROOT PVM_ARCH PVM_RSH PVM_TMP
4) make/build PVM
We are going to use ssh for communication, so it is important to change the way
PVM will try to request for connection.
go to /usr/share/pvm3/conf/ and do a listing.
you should see lot of files ending with .def.
Open $(PVM_ARCH).def file for editing, PVM_ARCH is LINUXI386 for me.
vi $(PVM_ARCH).def
change the ARCHFLAGS value in the file such that it reads /usr/bin/ssh instead of
/usr/bin/rsh
go to /usr/share/pvm3 and type make to build pvm again.
Before doing this make sure, you don't have pvm running at the background.
How do I check?
$ grep pvm | ps fu
$ kill -9 where id is the id value listed by the above command
5) Editing Host File
open /etc/hosts
edit the file and comment the line starting with 127.0.0.1.
Add entries for hosts in your network if you don't have DNS server installed locally.
#127.0.0.1 localhost homepc
192.168.1.11 deurali
192.168.1.13 bhakari
6) Final Configuration
Restart the system, or at the very least log off and log on again.
This is necessary to make sure everything we did from step 1 to 5 is available for us
to use.
7) Starting PVM
few pvm commands
type pvm, the pvm process will start
pvm>
few pvm commands
help shows all the commands available
conf shows list of host configuration
add adds the hostname to the PVM collection
spawn -> runs the prog
quit comes out of PVM, but PVM still runs in background
halt kills the PVM process
to view the list of hosts
pvm> conf
to add host to the pvm
pvm> add bhakari
suresh@bhakari's password:
It will ask you for the password, quite a lot of times and it may still fail.
To make it all smooth, do step 8 first.
8) Password less SSH
The idea is to negotiate a public/private key between two computers such that you don't
need to put the password everytime you want to connect to the machine.
For this example
The master machine is deurali
The slave machine is bhakari
We are trying to connect to bhakari without putting the password.
To do so, you have to first create a public key and private key in your master machine.
Then you need to transfer the public key file to the slave machine, where you want to connect
to without using any password.
in the master (deurali)
generate a public key/private key using ssh-keygen
[suresh@deurali ~] ssh-keygen -t rsa
option t stands for the type of cipher and rsa is one of the cipher which is well supported
by most SSH servers.
Leave all the file save options to default, when it asks for the location to save the keys.
It will ask you for the passphrase, you can leave it empty which is not a very good idea.
But if you leave it empty you won't be asked any extra information when you want to connect
from this machine.
if you left the default options, it should create two files in .ssh directory of your home
folder.
go to the .ssh directory
[suresh@deurali ~] cd ~/.ssh/
[suresh@deurali ~] ls
id_rsa id_rsa.pub known_hosts
Now execute the following command to do a secure copy of the public key
[suresh@deurali .ssh] scp id_rsa.pub suresh@bhakari:~/.ssh/id_rsa.key
suresh@bhakari's password:
Once the file is successfully copied to the remote computer, log on to the remote computer
using
[suresh@deurali .ssh] cd ..
[suresh@deurali ~] ssh suresh@bhakari
suresh@bhakari's password:
You will be asked the password this time because you haven't setup the passwordless
authentication yet.
Once logged on, change the current directory to .ssh
[suresh@bhakari ~]cd ~/.ssh
list the files in the .ssh folder
[suresh@bhakari .ssh] ls
id_rsa.key
Now we need to put the information contained in id_rsa.key to .ssh/authorized_keys
which is the default file name for the file containing public keys.
[suresh@bhakari .ssh]cat id_rsa.key >> authorized_keys
This will append the public key into the authorized_keys file.
Remember >> is for append and not >. Also note that you may not have authorized_keys file
already there in the remote machine. It will only be there if there was ssh authorization setup
earlier. We don't want to delete the other keys, so appending to the authorized_keys
is the recommended way.
delete the public key file that was copied over, as it is now merged into authorized_keys file.
[suresh@bhakari .ssh]rm id_rsa.key
If you want to change the default key filename or any other ssh specific behaviour,
edit /etc/ssh/sshd_config
disconnect from the remote machine and try to connect again
[suresh@bhakari .ssh]exit
[suresh@deurali ~] ssh bhakari
It won't ask for password this time, and will automatically connect. Do not delete the files
id_rsa.pub and id_rsa from your master computer.
[suresh@bhakari ~]
9) Check PVM connectivity
[suresh@deurali ~]pvm
pvm> conf
conf
1 host, 1 data format
HOST DTID ARCH SPEED DSIG
deurali 40000 LINUXI386 1000 0x00408841
pvm> add bhakari
add bhakari
1 successful
HOST DTID
bhakari 80000
pvm> conf
conf
2 hosts, 1 data format
HOST DTID ARCH SPEED DSIG
deurali 40000 LINUXI386 1000 0x00408841
bhakari 80000 LINUXI386 1000 0x00408841
That is all there is for configuring PVM.
Only proceed to 10, if 9 was successful.
10) Compiling and Running Programs in PVM
to compile
There are plenty of examples in /usr/share/pvm3/examples folder.
Let's try to compile them.
[suresh@deurali ~] cd /usr/share/pvm3/examples
[suresh@deurali examples] make hello
or if you want to manually compile it, say you have hello.c file
[suresh@deurali ~] gcc -O -I/usr/share/pvm3/include -L/usr/share/pvm3/lib/$PVM_ARCH hello.c -o hello -lpvm3
do the same for hello_other.c
These two files can be found in the examples directory
[suresh@deurali ~]
copy the hello and hello_other file to the $PVM_ROOT/bin/LINUXI386/
[suresh@deurali ~] cp hello hello_other /usr/share/pvm3/bin/LINUXI386/
Now you can either compile and copy in the remote machine's equivalent directory, /usr/share/pvm3/bin/LINUXI386 or you can simply copy
hello hello_other from master to the slave using scp.
once copied go to pvm
and add slave if it is not already added
pvm> add bhakari
to run the hello program
pvm> spawn -> hello
spawn -> hello
[1]
1 successful
t80001
pvm> [1:t80001] i'm t80001
[1:t80001] from t40002: hello, world from deurali
[1:t80001] EOF
[1:t40002] EOF
[1] finished
Hope this document was of some help to you.
This tutorial was designed with beginners in mind from my own experience, and
problems I faced while setting up PVM.
This is by no means the complete tutorial, please view the Readme file that
comes with your PVM installation for more information.
If you have any questions, forward them to suresh at uow.edu.au