Table of Contents
In this article, I will take you through the steps to install parallel ssh(pssh) on RedHat/CentOS 7. According to PSSH Man Page, pssh is a program for executing ssh in parallel on a number of hosts. It provides features such as sending input to all of the processes, passing a password to ssh, saving output to files, and timing out.
Why do we need pssh ?
You must have known about most frequently used ssh tool which can execute any command on only one host at a time. To overcome this problem we have a tool known as parallel ssh(pssh) which can run a command simultaneously on multiple hosts at a time.
Install Parallel SSH(pssh)
pssh tool is being used to execute same command on multiple linux terminals.
Also Read: How to Install and Use netstat command in Linux
Step 1: Prerequisites
a)You need to have atleast two running Linux nodes to test the pssh functionality.
b)All remotely used machine IP should be reachable from pssh installed node.
Step 2: Update your System
Before going through the pssh package installation, you need to update your system with the latest updates using yum update
command.
[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink | 9.1 kB 00:00:00
* base: centos.excellmedia.net
* epel: repos.del.extreme-ix.org
* extras: centos.excellmedia.net
* openstack-rocky: centos.excellmedia.net
* rdo-qemu-ev: centos.excellmedia.net
* updates: centos.excellmedia.net
..............................................................................................
Step 3: Download and Install pssh Package
Once the system is updated with latest updates, it is now time to install your pssh package from the repository using yum install pssh
command.
[root@localhost ~]# yum install pssh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: repos.del.extreme-ix.org
* extras: centos.excellmedia.net
* openstack-rocky: centos.excellmedia.net
* rdo-qemu-ev: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package pssh.noarch 0:2.3.1-5.el7 will be installed
--> Finished Dependency Resolution
.............................................................................................................
Step 4: Verify Installed pssh package
After successful installation of pssh package you can verify from rpm database if the package is indeed installed or not using rpm -qa command. You can grep the pssh package from rpm -qa command output to check the pssh package details.
[root@localhost ~]# rpm -qa | grep -i pssh
pssh-2.3.1-5.el7.noarch
Step 5: Check parallel ssh version
If you want to verify the pssh installed version, you can do that by running pssh --version
command. As you can notice from the output, current installed version is 2.3.1
[root@localhost ~]# pssh --version
2.3.1
NOTE:
If you have a set of hosts that you connect to frequently with specific options, it may be helpful to create an alias such as:
alias pssh_servers="pssh -h /path/to/server_list.txt -l root -A"
The ssh_config file can include an arbitrary number of Host sections. Each host entry specifies ssh options which apply only to the given host. Host definitions can even behave like aliases if the HostName option is included. This ssh feature, in combination with pssh host files, provides a tremendous amount of flexibility.
Step 6: Check pssh usage
It is now time to check the usage of pssh tool by launching a command for remote machine. Here I have choose to run simple date
command on remote machine 192.168.0.102.
[root@localhost ~]# pssh -H 'test@192.168.0.102' date
[1] 20:38:27 [SUCCESS] test@192.168.0.102
Step 7: Check Other Tools installed with pssh
We have other tools that comes along with pssh package are:-
- pnuke
- prsync
- pslurp
- pscp.pssh
Above tools executable path could be determined by using below command.
[root@localhost ~]# rpm -ql pssh | grep -i bin
/usr/bin/pnuke
/usr/bin/prsync
/usr/bin/pscp.pssh
/usr/bin/pslurp
/usr/bin/pssh
Step 8: Check pnuke tool version
As per pnuke man page, pnuke is a program for killing processes in parallel on a number of hosts. It provides features such as passing a password to ssh, saving output to files, and timing out. You can check pnuke version by running pnuke --version
command.
[root@localhost ~]# pnuke --version
2.3.1
Step 9: Check prsync tool version
As per prsync man page, prsync is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to ssh, saving output to files, and timing out. You can check prsync version by running prsync --version
command.
[root@localhost ~]# prsync --version
2.3.1
Step 10: Check pscp.pssh tool version
As per pscp.pssh man page, pscp is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to scp, saving output to files, and timing out. You can check pscp.pssh version by running pscp.pssh --version
command.
[root@localhost ~]# pscp.pssh --version
2.3.1
Step 11: Check pslurp tool version
As per pslurp man page, pslurp is a program for copying files in parallel from a number of hosts. It provides features such as passing a password to scp, saving output to files, and timing out. You can check pslurp version by running pslurp --version
command.
[root@localhost ~]# pslurp --version
2.3.1