1. Define a common user for all the machines with the same user name and make the home directory /mirror
madhawa@node0:~$ sudo useradd -d /mirror/mpiuser -m -s /bin/bash mpiuser
madhawa@node0:~$ sudo passwd mpiuser
This would prompt for a new password for the user id "mpiuser". Do the same thing to all the machines.
2. Make the mpiuser as the owner of the /mirror
madhawa@node0:~$ sudo chown mpiuser /mirror
3. Install the SSH server in all the machines.
madhawa@node0:~$ sudo apt-get install openssh-server
4. Setup the password-less log in.
login with the new user in su mode.
madhawa@node0:~$ su mpiuser
Generate DSA key pair for the mpiuser.
mpiuser@node0:~$ ssh-keygen -t dsa
This will prompt for a passphrase. Leave it empty.
A folder called .ssh is created in /mirror/mpiuser which contains the key file. Add this key to the authorized set of keys by issuing the following commands.
mpiuser@node0:~$ cd .ssh
mpiuser@node0:~/.ssh$ cat id_dsa.pub >> authorized_keys
mpiuser@node0:~/.ssh$ chmod 644 authorized_keys
To test the password-less login, issue the following command on the master node and if successful, this would return the host name of the nodes without asking for password or passphrase.
mpiuser@node0:~$ ssh node1 hostname
Note: Sometimes you may be prompted to enter password for once. But it won't be required again.
Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts
1. Setting Up the NFS on the Computer Cluster
I have 3 machines, each of which has Ubuntu 12.04 32bit installed. I have named my machine as node0, node1, node2.
Note: If you want to rename your machines in edit the /etc/hostname file:
madhawa@node0:~$ sudo nano /etc/hosts
and replace the current machine name with your preferred name.
So let's start the setting up.
1. Define the host names by editing the /etc/hosts file:
madhawa@node0:~$ sudo nano /etc/hosts
and put the following. Note that I have removed the line 127.0.1.1 node0
Note: If you want to rename your machines in edit the /etc/hostname file:
madhawa@node0:~$ sudo nano /etc/hosts
and replace the current machine name with your preferred name.
So let's start the setting up.
1. Define the host names by editing the /etc/hosts file:
madhawa@node0:~$ sudo nano /etc/hosts
and put the following. Note that I have removed the line 127.0.1.1 node0
127.0.0.1 localhost
10.16.32.10 node0
10.16.32.11 node1
10.16.32.12 node2
2. Install NFS server on the master node. I take the node0 as the master.
madhawa@node0:~$ sudo apt-get install nfs-kernel-server
madhawa@node0:~$ sudo apt-get install nfs-kernel-server
3. Make a new directory that is to be shared among all the nodes. My shared folder is /mirror. In order to share the edit the /etc/exports file:
madhawa@node0:~$ mkdir /mirror
madhawa@node0:~$ sudo nano /etc/exports
And put the following line to set the permissions for the nfs.
/mirror *(rw,sync)
4. Restart the server
madhawa@node0:~$ sudo service nfs-kernel-server restart
5. Install the NFS client programs on the other machines.
madhawa@node1:~$ sudo apt-get install nfs-common
6. Mount the shared folder on the other nodes.
madhawa@node0:~$ mkdir /mirror
madhawa@node0:~$ sudo nano /etc/exports
And put the following line to set the permissions for the nfs.
/mirror *(rw,sync)
4. Restart the server
madhawa@node0:~$ sudo service nfs-kernel-server restart
5. Install the NFS client programs on the other machines.
madhawa@node1:~$ sudo apt-get install nfs-common
6. Mount the shared folder on the other nodes.
madhawa@node1:~$ sudo mount node0:/mirror /mirror
madhawa@node2:~$ sudo mount node0:/mirror /mirror
Note: This is the folder that is used to put the shared files required for the distributed execution. NFS enables remote mount and access to the files in another machine.
madhawa@node2:~$ sudo mount node0:/mirror /mirror
Note: This is the folder that is used to put the shared files required for the distributed execution. NFS enables remote mount and access to the files in another machine.
Setting up a small MPI Cluster using MPICH on Linux (Ubuntu 12.04)
In the next few posts I am going to explain my experience on how to setup a MPI cluster with 3 Linux machines. I referred several online resources, extracted information and arranged them in the posts.
Specifications:
OS : Ubuntu 12.04 desktop or server Version
MPI : MPICH2
SSH : OpenSSH
Compiler : gcc 4.6.3
NFS
This post comes in 4 parts which describes the 4 main steps and they are as follows.
- Set up Network File System(NFS)
- Set up SSH password-less log in
- Install Compilers
- Install MPICH
So let's start!
(I'm putting the list of the references at the end of the post and I thank their authors for the great work)
(I'm putting the list of the references at the end of the post and I thank their authors for the great work)
Changing the username in Ubuntu/ Linux
- Log in using your username and password (username to be changed)
- Set a password for the root. Following will prompt for the new password.
sudo passwd root - Log out.exit
- Log in using the root account. Give the new password.
- If the user account of which the username is to be changed is still in use log out from that.
pkill -KILL -u username - Change the username and the home folder to the new user name.
usermod -l-d /home/ -m - Change the group name to the new group name that you want.
groupmod -n - Can check the group names using this.
groups - Better lock the root account.
- Log out from root and log in using the new username
- Done!
Subscribe to:
Posts (Atom)