linux升级安装openssh时出现依赖冲突
通过如下方式下载到openssh安装包
https://www.cnblogs.com/qq931399960/p/11120429.html
-rwxrwxrwx. 1 root root 157200 Jul 2 10:39 cryptsetup-2.0.3-3.el7.x86_64.rpm -rwxrwxrwx. 1 root root 345964 Jul 2 10:39 cryptsetup-libs-2.0.3-3.el7.x86_64.rpm -rwxrwxrwx. 1 root root 98680 Jul 2 10:39 libgudev1-219-62.el7_6.6.x86_64.rpm -rwxrwxrwx. 1 root root 165932 Jul 2 10:39 libselinux-2.5-14.1.el7.x86_64.rpm -rwxrwxrwx. 1 root root 191104 Jul 2 10:39 libselinux-devel-2.5-14.1.el7.x86_64.rpm -rwxrwxrwx. 1 root root 241132 Jul 2 10:39 libselinux-python-2.5-14.1.el7.x86_64.rpm -rwxrwxrwx. 1 root root 155092 Jul 2 10:39 libselinux-utils-2.5-14.1.el7.x86_64.rpm -rwxrwxrwx. 1 root root 154244 Jul 2 10:39 libsemanage-2.5-14.el7.x86_64.rpm -rwxrwxrwx. 1 root root 304196 Jul 2 10:39 libsepol-2.5-10.el7.x86_64.rpm -rwxrwxrwx. 1 root root 78740 Jul 2 10:39 libsepol-devel-2.5-10.el7.x86_64.rpm -rwxrwxrwx. 1 root root 100668 Jul 2 10:39 lz4-1.7.5-2.el7.x86_64.rpm -rwxrwxrwx. 1 root root 522344 Jul 2 10:39 openssh-7.4p1-16.el7.x86_64.rpm -rwxrwxrwx. 1 root root 670336 Jul 2 10:39 openssh-clients-7.4p1-16.el7.x86_64.rpm -rwxrwxrwx. 1 root root 469340 Jul 2 10:39 openssh-server-7.4p1-16.el7.x86_64.rpm -rwxrwxrwx. 1 root root 938004 Jul 2 10:39 policycoreutils-2.5-29.el7_6.1.x86_64.rpm -rwxrwxrwx. 1 root root 495512 Jul 2 10:39 selinux-policy-3.13.1-229.el7_6.12.noarch.rpm -rwxrwxrwx. 1 root root 7247400 Jul 2 10:39 selinux-policy-targeted-3.13.1-229.el7_6.12.noarch.rpm -rwxrwxrwx. 1 root root 5299428 Jul 2 10:39 systemd-219-62.el7_6.6.x86_64.rpm -rwxrwxrwx. 1 root root 416428 Jul 2 10:39 systemd-libs-219-62.el7_6.6.x86_64.rpm -rwxrwxrwx. 1 root root 135760 Jul 2 10:39 systemd-python-219-62.el7_6.6.x86_64.rpm -rwxrwxrwx. 1 root root 85736 Jul 2 10:39 systemd-sysv-219-62.el7_6.6.x86_64.rpm
安装的时候出现如下异常
[root@localhost openssh74pl]# rpm -ivh ./*.rpm error: Failed dependencies: selinux-policy-base < 3.13.1-66 conflicts with libselinux-2.5-14.1.el7.x86_64 systemd < 219-20 conflicts with libselinux-2.5-14.1.el7.x86_64 selinux-policy-base < 3.13.1-66 conflicts with libsemanage-2.5-14.el7.x86_64 selinux-policy < 3.13.1-92 conflicts with openssh-7.4p1-16.el7.x86_64
上述信息中,with后面为即将要安装的软件,开头为当前已经安装过的软件,查询已安装的selinux安装包
[root@localhost openssh74pl]# yum list installed | grep selinux-policy selinux-policy.noarch 3.13.1-60.el7 @anaconda selinux-policy-targeted.noarch 3.13.1-60.el7 @anaconda
版本为3.13.1-60.e17,确实低于3.13.1-66版本,而下载下来的安装包中包含3.13.1-229.el7的版本,满足要求的,但由于之前已经安装了低版本的软件,在安装其他依赖该低版本软件时,就会出现上述冲突。
有一种比较简洁的方法,就是添加上两个参数--force和--nodeps。由于通过yum downloadonly下载了完整的包,那在当前版本的CentOS中,将这些包全部安装,就能正常升级openssh,所以也不需要逐个依赖依次安装,或者先卸载之前版本在安装。
rpm -ivh ./openssh74pl/*.rpm --force --nodeps
-- force 强制安装/卸载
--nodeps 安装/卸载时不检查依赖关系
安装完成后,验证openssh升级到了7.4版本
[root@localhost bugfix]# ssh -V OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017