Home » Guides » Install CSSH On Linux: A Complete Guide For Debian, Ubuntu, CentOS, RHEL, And So On

Install CSSH On Linux: A Complete Guide For Debian, Ubuntu, CentOS, RHEL, And So On

If you have ever been a system administrator, you are surely familiar with your fair share of machines to work on. You are used to maintaining many systems daily, whether web servers, cloud storage, or something else. Thus, you must have needed a tool that could let you command multiple machines at once. Cluster SSH, or CSSH, is one such tool.

CSSH is invaluable for managing multiple servers simultaneously. You can use it to control multiple SSH sessions running parallelly on your machines. CSSH also makes it easier for you to execute commands across a cluster of systems, as it is designed to streamline the management of multiple servers. You can open several terminal windows and command your systems with a master window.

Table Of Contents

What is CSSH?

Cluster SSH or CSSH for short, is a Perl program (or a Tk/Perl wrapper around standard XTerm and SSH, to be exact). It allows system admins to manage multiple servers simultaneously, as stated above, by controlling multiple SSH sessions running parallelly. It works on almost any POSIX-compliant OS with libraries, such as Linux. 

You can use CSSH to execute a command across multiple machines from a singular, central host. It has the following features:

  • Runs on multiple servers simultaneously. 
  • Very efficient
  • Avoids repetitive SSH connections
  • Very Consistent
  • Connected servers receive the same commands and updates
  • Can be used to control numerous servers.
cssh, install cssh on linux
CSSH

System Prerequisites

Before installing CSSH on your Linux system, you have to ensure the following:

  • A system running Linux (supported distribution)
  • Admin rights
  • SSH access to the servers

How To Install CSSH On Linux?

There are several methods to install CSSH on Linux. We have included a few possible methods below. All you have to do is follow the steps described below to install CSSH in a few easy steps:

Method 1. Install CSSH On Linux Using Native Repositories

First, you can use the native Linux repositories to install CSSH:

For Systems Running Debian/Ubuntu

Step 1. Start by updating your system

sudo apt update

Step 2. Then, install Cluster SSH

sudo apt install clusterssh

Step 3. Lastly, verify the installation

cssh --version

For Systems Running CentOS/RHEL 7

Cluster SSH might not be directly available for CentOS, RHEL, or Fedora. In that case, you can still install it via the EPEL (Extra Packages for Enterprise Linux) repository.

Step 1. First, enable the EPEL repository:

sudo yum install epel-release

Step 2. Then, update the package:

sudo yum update

Step 3. Then, install CSSH

sudo yum install clusterssh

Step 4. Finally, verify the installation

cssh --version

For Systems Running RHEL 8/Fedora/CentOS

Step 1. Similar to the previous method, start by enabling EPEL:

sudo dnf install epel-release

Step 2. Again, update the package list:

sudo dnf update

Step 3. Then, install Cluster SSH

sudo dnf install clusterssh

Step 4. Lastly, verify the installation

cssh --version

On Arch Linux/Manjaro

You will first need an AUR helper. You can go with either YAY or TRIZEN:

Step 1. Install an AUR helper if not already installed:

For ‘YAY’
sudo pacman -S yay
For ‘TRIZEN’
sudo pacman -S trizen

Step 2. Install Cluster SSH using the AUR helper:

With ‘YAY’
yay -S clusterssh
With ‘TRIZEN’
trizen -S clusterssh

Step 3. Finally, Verify The Installation

cssh --version

On OpenSUSE

Step 1. Update the package list:

sudo zypper refresh

Step 2. Install Cluster SSH:

sudo zypper install clusterssh

Step 3. Verify the installation:

cssh --version

Method 2. Install CSSH On Linux Using CPAN

Note: This method works on most Linux distributions:

Step 1. Install CPAN and dependencies:

For Ubuntu/Debian Based Systems

sudo apt install cpanminus perl

For RHEL/CentOS/Fedora

sudo yum install perl-App-cpanminus perl

On Arch Linux

sudo pacman -S perl-cpanminus

On OpenSUSE

sudo zypper install perl-App-cpanminus

Step 2. Install Cluster SSH via CPAN:

sudo cpanm App::ClusterSSH

Step 3. Lastly, verify the installation:

cssh --version

Method 3. Building CSSH On Linux From Source

Of course, you can forgo the native repositories and CPAN to build CSSH from the source directly. All you have to do is:

Step 1: Install Relevant Dependencies

For Debian/Ubuntu:

sudo apt update
sudo apt install build-essential git perl libgtk2-perl libapp-cpanminus-perl

For Red Hat/CentOS/Fedora:

sudo yum groupinstall 'Development Tools'
sudo yum install git perl-Gtk2 perl-App-cpanminus

On Arch Linux:

sudo pacman -S base-devel git perl-gtk2 perl-cpanminus

For OpenSUSE:

sudo zypper install -t pattern devel_basis
sudo zypper install git perl-Gtk2 perl-App-cpanminus

Step 2. Clone the CSSH repository from GitHub or a mirror:

git clone https://github.com/duncs/clusterssh.git

Step 3. Navigate to the cloned directory:

cd clusterssh

Step 4. Now, install the Perl dependencies:

sudo cpanm --installdeps .

Step 5. Lastly, install CSSH:

perl Makefile.PL
make
sudo make install

Step 6. Verify Installation

cssh --version

Method 4. Install CSSH On Linux Using Docker

In this method, you can run CSSH inside a Docker container, using Docker Images. Here’s how:

Step 1: Install Docker

On CentOS/RHEL

Step 1.1 – Set up the repository by installing the yum-utils package (which provides the yum-config-manager utility)

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Step 1.2 – Install Docker Engine

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

On Debian/Ubuntu

Step 1.1 –Start by adding Docker’s official GPG key:

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 1.2 – Add the repository to Apt sources:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 1.3 – Update the APT repo:

sudo apt-get update

Step 1.4 – Install the Docker packages.

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

For Fedora

Step 1.1 – To Set up the repository, start by installing the dnf-plugins-core package:

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

Step 1.2 – Install Docker Engine, containerd, and Docker Compose:

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 2: Create a Dockerfile

FROM ubuntu:latest

RUN apt-get update && apt-get install -y \
    clusterssh \
    openssh-client \
    x11-apps

CMD ["bash"]

Step 3. Build the Docker image:

docker build -t cssh-image .

Step 4. Run a container from the image:

docker run -it --rm --name cssh-container cssh-image

Step 5. Finally, you can use CSSH inside the container:

cssh user@host1 user@host2
Gilbert John Avatar