centos7.5升級7.9
阿新 • • 發佈:2022-03-25
1. 當前版本資訊
[root@localhost ~]# cat /proc/version Linux version 3.10.0-862.14.4.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Wed Sep 26 15:12:11 UTC 2018 [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@localhost~]# ssh -V OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 [root@localhost ~]# rpm -qa | grep openssh openssh-clients-7.4p1-16.el7.x86_64 openssh-server-7.4p1-16.el7.x86_64 openssh-7.4p1-16.el7.x86_64
2. 升級過程
2.1. remove
yum remove -y openssh openssh-clients openssh-server setenforce 0
2.2. dependency
yum install -y gcc openssl openssl-devel wget
2.3. user and group
userdel -r sshd
groupdel sshd # 這裡會提示沒有這個組
2.4. prepare
install -v -m700 -d /var/lib/sshd chown -v root:sys /var/lib/sshd groupadd -g 51 sshd # 注意,如果這裡提示51已經被使用,可以嘗試52,以此類推 useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd -s /bin/false -u 51sshd
系統裡所有的group以及它們對應的id是多少,可以檢視檔案:vi /etc/group
2.5. download
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz tar -zvxf openssh-7.9p1.tar.gz cd openssh-7.9p1
2.6. install
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-privsep-path=/var/lib/sshd make
2.7. file operation
chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key
2.8. install
make install
2.9. config
install -v -m755 contrib/ssh-copy-id /usr/bin install -v -m644 contrib/ssh-copy-id.1 /usr/share/man/man1 install -v -m755 -d /usr/share/doc/openssh-7.9p1 install -v -m644 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-7.9p1 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config # 允許root遠端登入 cp -p contrib/redhat/sshd.init /etc/init.d/sshd chmod +x /etc/init.d/sshd chkconfig --add sshd chkconfig sshd on chkconfig --list sshd systemctl restart sshd
3. 測試
[root@mobaji openssh-7.9p1]# ssh -V OpenSSH_7.9p1, OpenSSL 1.0.2k-fips 26 Jan 2017