In newer releases of Red Hat Enterprise Linux and CentOS Stream, version 8 and above currently, there is no libssh2 developer package provided.


To use libssh2, you must enable the EPEL repository. After that, libssh2-devel can be installed.


Enable EPEL repo on CentOS Stream 8 and 9


Run the following command to enable EPEL on CentOS 8/9:

> sudo dnf install epel-release


Enable EPEL repo on Red Hat Enterprise Linux 8


First, enable the RHEL provided Code Ready Builder repository with this command:

> sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms


Next, run the following command to enable EPEL on RHEL 8:


> sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm


Enable EPEL repo on Red Hat Enterprise Linux 9


First, enable the RHEL provided Code Ready Builder repository with this command:


> sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms


Next, run the following command to enable EPEL on RHEL 9:


> sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm


Install libssh2


If development is needed on the platform then use the libssh2-devel package


> sudo dnf install libssh2-devel


If development is not needed on the platform then use the libssh2 package


> sudo dnf install libssh2
 


If the above solutions do not work, you can download the libssh2 source tarball from https://www.libssh2.org/

and then run the following commands (assuming the libssh2-1.10.0.tar.gz tarball is in the Downloads folder of your system):

 

> cd ~/Downloads
> tar -xvf libssh2-1.10.0.tar.gz
> cd libssh2-1.10.0
> ./configure
> make
> sudo make install