DEV Community

Janak Shrestha
Janak Shrestha

Posted on

Install a package

As per new application requirements shared by the Nautilus project development team, serveral new packages need to be installed on all app servers in Stratos Datacenter. Most of them are completed except for rsync.

Therefore, install the rsync package on all app-servers.


Solution

Step 1: Connect to Each App Server and Install rsync

App Server 1 (stapp01) - User: tony

ssh tony@stapp01
# Password: Ir0nM@n
sudo su -
# Password: Ir0nM@n
yum install -y rsync
exit
exit
Enter fullscreen mode Exit fullscreen mode

App Server 2 (stapp02) - User: steve

ssh steve@stapp02
# Password: Am3ric@
sudo su -
# Password: Am3ric@
yum install -y rsync
exit
exit
Enter fullscreen mode Exit fullscreen mode

App Server 3 (stapp03) - User: banner

ssh banner@stapp03
# Password: BigGr33n
sudo su -
# Password: BigGr33n
yum install -y rsync
exit
exit
Enter fullscreen mode Exit fullscreen mode

One-Line Commands

App Server 1 (stapp01):

echo 'Ir0nM@n' | ssh tony@stapp01 "sudo -S yum install -y rsync"
Enter fullscreen mode Exit fullscreen mode

App Server 2 (stapp02):

echo 'Am3ric@' | ssh steve@stapp02 "sudo -S yum install -y rsync"
Enter fullscreen mode Exit fullscreen mode

App Server 3 (stapp03):

echo 'BigGr33n' | ssh banner@stapp03 "sudo -S yum install -y rsync"
Enter fullscreen mode Exit fullscreen mode

Using Heredoc (Recommended)

App Server 1:

ssh tony@stapp01 << 'EOF'
echo 'Ir0nM@n' | sudo -S bash -c '
echo "=== Installing rsync on stapp01 ==="
yum install -y rsync
echo "✓ rsync installed"
rsync --version | head -1
'
EOF
Enter fullscreen mode Exit fullscreen mode

App Server 2:

ssh steve@stapp02 << 'EOF'
echo 'Am3ric@' | sudo -S bash -c '
echo "=== Installing rsync on stapp02 ==="
yum install -y rsync
echo "✓ rsync installed"
rsync --version | head -1
'
EOF
Enter fullscreen mode Exit fullscreen mode

App Server 3:

ssh banner@stapp03 << 'EOF'
echo 'BigGr33n' | sudo -S bash -c '
echo "=== Installing rsync on stapp03 ==="
yum install -y rsync
echo "✓ rsync installed"
rsync --version | head -1
'
EOF
Enter fullscreen mode Exit fullscreen mode

Automated Script (Run from Jump Host)

#!/bin/bash

echo "========================================="
echo "Installing rsync on All App Servers"
echo "========================================="

# stapp01
echo ""
echo "=== stapp01 ==="
ssh tony@stapp01 << 'EOF'
echo 'Ir0nM@n' | sudo -S bash -c '
yum install -y rsync
echo "rsync version:"
rsync --version | head -1
'
EOF

# stapp02
echo ""
echo "=== stapp02 ==="
ssh steve@stapp02 << 'EOF'
echo 'Am3ric@' | sudo -S bash -c '
yum install -y rsync
echo "rsync version:"
rsync --version | head -1
'
EOF

# stapp03
echo ""
echo "=== stapp03 ==="
ssh banner@stapp03 << 'EOF'
echo 'BigGr33n' | sudo -S bash -c '
yum install -y rsync
echo "rsync version:"
rsync --version | head -1
'
EOF

echo ""
echo "========================================="
echo "✅ rsync installed on all App servers!"
echo "========================================="
Enter fullscreen mode Exit fullscreen mode

Expected Output

[root@stapp01 ~]# yum install -y rsync
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package rsync-3.2.7-1.el9.x86_64 already installed and latest version
Nothing to do

[root@stapp01 ~]# rsync --version
rsync version 3.2.7 protocol version 31
Copyright (C) 1996-2022 by Andrew Tridgell, Wayne Davison, and others.
...
Enter fullscreen mode Exit fullscreen mode

Verification Commands

# Check rsync installation on all servers
ssh tony@stapp01 "rsync --version | head -1"
ssh steve@stapp02 "rsync --version | head -1"
ssh banner@stapp03 "rsync --version | head -1"

# Check package installation
ssh tony@stapp01 "rpm -qa | grep rsync"
ssh steve@stapp02 "rpm -qa | grep rsync"
ssh banner@stapp03 "rpm -qa | grep rsync"

# Check rsync binary location
ssh tony@stapp01 "which rsync"
ssh steve@stapp02 "which rsync"
ssh banner@stapp03 "which rsync"
Enter fullscreen mode Exit fullscreen mode

Complete Verification Script

#!/bin/bash

echo "========================================="
echo "Verifying rsync Installation"
echo "========================================="

SERVERS=("stapp01:tony" "stapp02:steve" "stapp03:banner")

for server_info in "${SERVERS[@]}"; do
    IFS=':' read -r server user <<< "$server_info"
    echo ""
    echo "=== $server ==="
    ssh "$user@$server" "rsync --version 2>/dev/null | head -1 || echo 'rsync not installed'"
    ssh "$user@$server" "rpm -qa 2>/dev/null | grep rsync || echo 'Package not found'"
done

echo ""
echo "========================================="
echo "✅ Verification complete!"
echo "========================================="
Enter fullscreen mode Exit fullscreen mode

Summary

  • rsync installed on stapp01 (tony)
  • rsync installed on stapp02 (steve)
  • rsync installed on stapp03 (banner)
  • ✅ Packages verified on all servers

The rsync package has been successfully installed on all App servers in the Stratos Datacenter.

Top comments (0)