How To Install openssh on CentOS 8

openssh is An open source implementation of SSH protocol version 2

Introduction

In this tutorial we learn how to install openssh on CentOS 8.

What is openssh

SSH (Secure SHell) is a program for logging into and executing commands on a remote machine. SSH is intended to replace rlogin and rsh, and to provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. OpenSSH is OpenBSD’s version of the last free version of SSH, bringing it up to date in terms of security and features. This package includes the core files necessary for both the OpenSSH client and server. To make this package useful, you should also install openssh-clients, openssh-server, or both.

We can use yum or dnf to install openssh on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install openssh.

Install openssh on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install openssh using dnf by running the following command:

sudo dnf -y install openssh

Install openssh on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install openssh using yum by running the following command:

sudo yum -y install openssh

How To Uninstall openssh on CentOS 8

To uninstall only the openssh package we can use the following command:

sudo dnf remove openssh

openssh Package Contents on CentOS 8

/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/lib/.build-id
/usr/lib/.build-id/0b
/usr/lib/.build-id/0b/bdc4d92ff3c605b56714b6510fccde281765e5
/usr/lib/.build-id/58
/usr/lib/.build-id/58/7ef4180fd17a06c2f3ae9c1ccb8bcdb46b4fe5
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
/usr/share/doc/openssh
/usr/share/doc/openssh/CREDITS
/usr/share/doc/openssh/ChangeLog
/usr/share/doc/openssh/INSTALL
/usr/share/doc/openssh/OVERVIEW
/usr/share/doc/openssh/PROTOCOL
/usr/share/doc/openssh/PROTOCOL.agent
/usr/share/doc/openssh/PROTOCOL.certkeys
/usr/share/doc/openssh/PROTOCOL.chacha20poly1305
/usr/share/doc/openssh/PROTOCOL.key
/usr/share/doc/openssh/PROTOCOL.krl
/usr/share/doc/openssh/PROTOCOL.mux
/usr/share/doc/openssh/README
/usr/share/doc/openssh/README.dns
/usr/share/doc/openssh/README.platform
/usr/share/doc/openssh/README.privsep
/usr/share/doc/openssh/README.tun
/usr/share/doc/openssh/TODO
/usr/share/licenses/openssh
/usr/share/licenses/openssh/LICENCE
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz
/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/lib/.build-id
/usr/lib/.build-id/79
/usr/lib/.build-id/79/78565c6d1dea9e6924af6a1349debc256fec5a
/usr/lib/.build-id/e9
/usr/lib/.build-id/e9/78e741a91241144e014b6ebdd050c918947acb
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
/usr/share/doc/openssh
/usr/share/doc/openssh/CREDITS
/usr/share/doc/openssh/ChangeLog
/usr/share/doc/openssh/INSTALL
/usr/share/doc/openssh/OVERVIEW
/usr/share/doc/openssh/PROTOCOL
/usr/share/doc/openssh/PROTOCOL.agent
/usr/share/doc/openssh/PROTOCOL.certkeys
/usr/share/doc/openssh/PROTOCOL.chacha20poly1305
/usr/share/doc/openssh/PROTOCOL.key
/usr/share/doc/openssh/PROTOCOL.krl
/usr/share/doc/openssh/PROTOCOL.mux
/usr/share/doc/openssh/README
/usr/share/doc/openssh/README.dns
/usr/share/doc/openssh/README.platform
/usr/share/doc/openssh/README.privsep
/usr/share/doc/openssh/README.tun
/usr/share/doc/openssh/TODO
/usr/share/licenses/openssh
/usr/share/licenses/openssh/LICENCE
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz

References

Summary

In this tutorial we learn how to install openssh on CentOS 8 using yum and dnf.