Installing OpenSSH 5.8 Centos 5.5

I needed to CHroot an SFTP connection and wanted to use the latest OPENSSH package. I am running CentOS 5.5 and there is no rpm available.

So using the following instructions created my own. It appears that you may be able to do this with most sources. One thing to not is that you will need the prerequisites to install the rpm, so reading the readme or install instructions of the original source is a must.

The RPM creation was taken from the following site and works perfectly.

Download the relevant openshh source from which ever mirror site you want a list can be found here

I downloaded the 5.8p2 version which was the latest at the time

There are some prereques for an RPM build

yum install gcc
yum install openssl-devel
yum install pam-devel
yum install rpm-build

I then removed the older version of openssh. I am not sure if this is needed but I read on one blog that it was ???

yum erase openssh

Please note you will not be able to create a new ssh connection once this has been done

mkdir /software
cd /software
gzip -d openssh-5.8p2.tar.gz
tar -xvf openssh-5.8p2.tar.gz
cp openssh-5.8p2/contrib/redhat/openssh.spec /usr/src/redhat/SPECS/
gzip openssh-5.8p2.tar

From a comment it looks like I put a bit of a typo in here

cp openssh-5.2p1.tar.gz /usr/src/redhat/SOURCES/

Should read

cp openssh-5.8p2.tar.gz /usr/src/redhat/SOURCES/
cd /usr/src/redhat/SPECS
perl -i.bak -pe 's/^(%define no_(gnome|x11)_askpass)\s+0$/$1 1/' openssh.spec

rpmbuild -bb openssh.spec
 cd /usr/src/redhat/RPMS/`uname -i

ls -l should display 3 rpm files

OPENSSH relies on the following to be installed also zlib and openssl

zlib can be found here 1.2.5 was the latest release at the time of writing

cd /software
gzip -d zlib-1.2.5.tar.gz
tar -xvf zlib-1.2.5.tar
cd zlib-1.2.5.tar
make install

open ssl can be found here  at the time of writing 0.9.8 was the latest release

gzip - d openssl-0.9.8r.tar.gz
tar -xvf openssl-0.9.8r.tar
cd openssl-0.9.8r
make install
cd /usr/src/redhat/RPMS/`uname -i
rpm -Uvh openssh*rpm

This will install the latest ssh

service sshd restart

Will test if this has worked.

How to CHroot can be found here


5 Comments on “Installing OpenSSH 5.8 Centos 5.5”

  1. […] Ensure the latest OPENSSH is installed a guide can be found here […]

  2. Maciek says:

    Thanks for great instructions. They allowed me to upgrade OpenSSH on Oracle Linux 6U1 (former Redhat).
    I needed to install the following additional packages on my bare install of Oracle Linux before building RPM:


    (Maybe it will prove useful to someone)

    Erasing previous version of OpenSSH was not needed in my case (rpm -U upgraded already installed packages without any problems).

  3. Check your quotes around the perl command – Looks like your wysiwyg editor may have borked them, I had to replace with single quotes

    Once I had my rpms built, I used the following to update my system :
    yum –nogpgcheck localinstall openssh-clients-5.8p2-1.i386.rpm openssh-5.8p2-1.i386.rpm openssh-server-5.8p2-1.i386.rpm

  4. Texoc says:


    What’s this line?
    cp openssh-5.2p1.tar.gz /usr/src/redhat/SOURCES/

    • It looks like have a typo I have changed the instructions, I have not rechecked it but I think this is what it should be. Can you please feed back the command that you used. Cheers Alistair

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s