Update openssh7.9 on CENTOS6

Source: Internet
Author: User
Tags rpmbuild

First, make RPM installation package
1) Dependent installation
Yum install rpm-build gcc make wget openssl-devel krb5-devel pam-devel libx11-devel xmkmf libxt-devel

2) Directory Creation
Mkdir-p/usr/src/redhat/{sources,specs}
cd/usr/src/redhat/sources/

3) installation File download
wget https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/openssh-7.9.tar.gz
wget https://src.fedoraproject.org/repo/pkgs/openssh/x11-ssh-askpass-1.2.4.1.tar.gz/ 8f2e41f3f7eaa8543a2440454637f3c3/x11-ssh-askpass-1.2.4.1.tar.gz

4) unzip the compiled file
cd/usr/src/redhat/sources/
Tar xfz openssh-7.9p1.tar.gz Openssh-7.9p1/contrib/redhat/openssh.spec
MV Openssh-7.9p1/contrib/redhat/openssh.spec. /specs/
Chown Sshd:sshd/usr/src/redhat/specs/openssh.spec
Cp/usr/src/redhat/specs/openssh.spec/usr/src/redhat/specs/openssh.spec_bak

5) To modify several configuration options options
#关掉no_gnome_askpass No_x11_askpass These two parameters
Sed-i-E "s/%define no_gnome_askpass 0/%define no_gnome_askpass 1/g"/usr/src/redhat/specs/openssh.spec
Sed-i-E "s/%define no_x11_askpass 0/%define no_x11_askpass 1/g"/usr/src/redhat/specs/openssh.spec
#查看修改了哪些参数
Diff Openssh.spec Openssh.spec_bak

6) Copy the installation software to the precompiled directory
mkdir-pv/root/rpmbuild/sources/
cp/usr/src/redhat/sources/openssh-7.9p1.tar.gz/root/rpmbuild/sources/
cp/usrsrc/redhat/sources/x11-ssh-askpass-1.2.4.1.tar.gz/root/rpmbuild/sources/
#执行编译操作
cd/usr/src/redhat/specs/
Rpmbuild-ba Openssh.spec
#编译后生成的目录结构如下
Tree-l 2/root/rpmbuild/
/root/rpmbuild/
├──build
│?? └──openssh-7.9p1
├──buildroot
├──rpms
│?? └──x86_64
├──sources
│?? ├──openssh-7.9p1.tar.gz
│?? └──x11-ssh-askpass-1.2.4.1.tar.gz
├──specs
└──srpms
└──openssh-7.9p1-1.el6.src.rpm
#编译后RPM包目录
/root/rpmbuild/rpms/x86_64/openssh-7.9p1-1.el6.x86_64.rpm
/root/rpmbuild/rpms/x86_64/openssh-clients-7.9p1-1.el6.x86_64.rpm
/root/rpmbuild/rpms/x86_64/openssh-debuginfo-7.9p1-1.el6.x86_64.rpm
/root/rpmbuild/rpms/x86_64/openssh-server-7.9p1-1.el6.x86_64.rpm
#取出供其他机器安装的RPM包
mkdir-pv/root/openssh7.9
CP/ROOT/RPMBUILD/RPMS/X86_64/{OPENSSH-7.9P1-1.EL6.X86_64.RPM,OPENSSH-CLIENTS-7.9P1-1.EL6.X86_64.RPM, OPENSSH-SERVER-7.9P1-1.EL6.X86_64.RPM}/root/openssh7.9

6) I play the RPM package, lazy people can be directly under, CENTOS6! It's CENTOS6! It's CENTOS6! 7 Don't pretend!
Https://pan.baidu.com/s/1UNete3cn9tX5taQt30qnwg

Second, the use of RPM installation package, upgrade OpenSSH to 7.9
1) View the system has OpenSSH installation package version
#如果曾经有手动编译安装, it may not be possible to find information
Rpm-qa|grep OpenSSH
2) Check to see which files are installed for the old RPM package and the new RPM version to install
Catalog of CD OpenSSH new RPM packages
RPM-QL OpenSSH-???.??? P1
RPM-QPL openssh-7.9p1-1.el6.x86_64.rpm
RPM-QL openssh-clients-???.??? P1
RPM-QPL openssh-clients-7.9p1-1.el6.x86_64.rpm
RPM-QL Openssh-server-???.??? P1
RPM-QPL openssh-server-7.9p1-1.el6.x86_64.rpm
3) selectively backup some configurations
#备份原有的openssh服务
Mkdir-pv/root/oppenssh_backup
Cd/root/oppenssh_backup
Tar-cvzf Etc_ssh.tar.gz/etc/ssh
TAR-CVZF etcPAMD.TAR.GZ/ETC/PAM.D
Cp/etc/pam.d/sshd/etc/pam.d/system-auth.
Cp-p/etc/pam.d/sshd/etc/pam.d/sshd
date +%Y%m%d
Cp-p/etc/pam.d/system-auth/etc/pam.d/system-auth_date +%Y%m%d
In general, RPM packages are installed with a configuration file of the same name that is not overwritten. Renames the resulting file with the same name as Filename.rpmnew
4) Upgrade Installation rpm
May explode for a variety of reasons, it is recommended to open more than a few ssh windows, insurance can also install Telnet and test the connection, guaranteed OpenSSH configuration error, the server does not lose the link
Catalog of CD OpenSSH new RPM packages
RPM-UVH./
. rpm
5) Modify the configuration file as needed
Check whether the/etc/pam.d/sshd/etc/pam.d/system-auth/etc/ssh/sshd.conf is the pre-upgrade configuration, changed to back up the newly generated configuration file, and then use the backup file to replace the configuration file back to the pre-upgrade configuration.
6) Restart SSHD Service
#CentOS 6
Service sshd Restart
#CentOS 7
#systemctl Restart sshd
7) Reconnect to view version
Ssh-v

Update openssh7.9 on CENTOS6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.