Jobacle

Script for setting up ssh on RAC-nodes

Finished a RAC-course a while ago with instructor Harald van Breederode. Noticed that he used a script for setting up ssh on the nodes. Short, powerful. Used it myself with user grid and oracle while installing 11g RAC.

First of all, one file should exist on forehand: $HOME:nodeinfo. Should look like this, one noder per line:

rac1
rac2

Then the file ssh_setup.sh:

if [ `whoami` != “grid” ]
then
echo “You must execute this as user grid!!!”;exit
fi
LOCAL=`hostname -s`
REMOTE=`sed -n 2p $HOME/nodeinfo`
ssh $REMOTE rm -rf /home/grid/.ssh
rm -rf /home/grid/.ssh
ssh-keygen -t rsa  -f $HOME/.ssh/id_rsa -N ” -q
touch $HOME/.ssh/authorized_keys
chmod 600  $HOME/.ssh/authorized_keys
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
chmod 400  $HOME/.ssh/authorized_keys
ssh -o StrictHostKeyChecking=no -q $LOCAL /bin/true
scp -o StrictHostKeyChecking=no -q -r $HOME/.ssh $REMOTE:
# and now add the host keys for the FQDN  hostnames
ssh -o StrictHostKeyChecking=no -q ${LOCAL} /bin/true
ssh -o StrictHostKeyChecking=no -q ${REMOTE} /bin/true
ssh -o StrictHostKeyChecking=no -q ${LOCAL}.jobacle.nl /bin/true
ssh -o StrictHostKeyChecking=no -q ${REMOTE}.jobacle.nl /bin/true
scp -q $HOME/.ssh/known_hosts $REMOTE:$HOME/.ssh/known_hosts

The file above has been used for the user ‘grid’, for installing a infrastructure. Slightly modify this for user oracle while installing a database.

Thanks Harald!

Exit mobile version