清除原有的yum,epel源等
dnf -y remove rpmconf yum-utils epel-release
安装最新系统的重要三个内核文件,选取自己系统适合的内核文件
#Rocky Linux 9 _x64
dnf -y install https://os.iso.st/r9/minimal/Packages/rocky-release-9.1-1.10.el9.noarch.rpm https://os.iso.st/r9/minimal/Packages/rocky-repos-9.1-1.10.el9.noarch.rpm https://os.iso.st/r9/minimal/Packages/rocky-gpg-keys-9.1-1.10.el9.noarch.rpm
#Rocky Linux 9 _aarch64
dnf -y install https://os.iso.st/r9arch/minimal/Packages/rocky-release-9.1-1.10.el9.noarch.rpm https://os.iso.st/r9arch/minimal/Packages/rocky-repos-9.1-1.10.el9.noarch.rpm https://os.iso.st/r9arch/minimal/Packages/rocky-gpg-keys-9.1-1.10.el9.noarch.rpm
显示下面内容即可进行下一步
Cleanup : rocky-gpg-keys-8.6-3.el8.noarch 6/6
Running scriptlet: rocky-gpg-keys-8.6-3.el8.noarch 6/6
Line is not an assignment at '/usr/lib/sysctl.d/50-redhat.conf:8': (null)
Couldn't write '1' to 'net/ipv4/conf/*/rp_filter', ignoring: No such file or directory
warning: %transfiletriggerin(systemd-239-58.el8.x86_64) scriptlet failed, exit status 1
Error in <unknown> scriptlet in rpm package rocky-gpg-keys
Verifying : rocky-release-9.1-1.10.el9.noarch 1/6
Verifying : rocky-release-8.6-3.el8.noarch 2/6
Verifying : rocky-repos-9.1-1.10.el9.noarch 3/6
Verifying : rocky-repos-8.6-3.el8.noarch 4/6
Verifying : rocky-gpg-keys-9.1-1.10.el9.noarch 5/6
Verifying : rocky-gpg-keys-8.6-3.el8.noarch 6/6
Upgraded:
rocky-gpg-keys-9.1-1.10.el9.noarch rocky-release-9.1-1.10.el9.noarch
rocky-repos-9.1-1.10.el9.noarch
Complete!
[root@iZuf6g ~]#
升级Rocky Linux
dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync
centos stream9 --releaserver=9-stream
结束后可能会出现以下两个错误,需进行处理,其他错误自行参考解决,或者留言进行辅助解决
①:file /usr/share/redhat-logos ... el8 ...el9类似的长文。此错误表示原有的文件和el9不兼容,删除该目录即可,稍后会自动生成创建。
rm -rf /usr/share/redhat-logos
②:file ...epel-rpm-macros-systemd.el8 ... el9类似的长文,等同上述,存在兼容问题,卸载稍后重装即可。
dnf remove -y epel-rpm-macros-systemd
等待结束后显示下面内容即表示已升级成功。
python3-librepo-1.14.2-3.el9.x86_64
python3-packaging-20.9-5.el9.noarch
python3-subscription-manager-rhsm-1.29.30.1-1.el9_1.x86_64
rpm-sign-libs-4.16.1.3-19.el9_1.x86_64
rsyslog-logrotate-8.2102.0-105.el9.x86_64
sombok-2.4.0-16.el9.x86_64
subscription-manager-1.29.30.1-1.el9_1.x86_64
subscription-manager-rhsm-certificates-20220623-1.el9.noarch
sysprof-capture-devel-3.40.1-3.el9.x86_64
systemd-rpm-macros-250-12.el9_1.3.noarch
usermode-1.114-4.el9.x86_64
userspace-rcu-0.12.1-6.el9.x86_64
util-linux-core-2.37.4-9.el9.x86_64
webkit2gtk3-jsc-2.36.7-1.el9_1.2.x86_64
xml-common-0.6.3-58.el9.noarch
zstd-1.5.1-2.el9.x86_64
Removed:
gcc-toolset-10-10.1-0.el8.x86_64
gcc-toolset-10-annobin-9.29-2.el8.3.x86_64
gcc-toolset-10-dyninst-10.2.1-2.el8.x86_64
gcc-toolset-10-gcc-10.3.1-1.2.el8_5.x86_64
gcc-toolset-10-gcc-c++-10.3.1-1.2.el8_5.x86_64
gcc-toolset-10-gcc-gdb-plugin-10.3.1-1.2.el8_5.x86_64
gcc-toolset-10-gcc-gfortran-10.3.1-1.2.el8_5.x86_64
gcc-toolset-10-gdb-9.2-4.el8.x86_64
gcc-toolset-10-libquadmath-devel-10.3.1-1.2.el8_5.x86_64
gcc-toolset-10-perftools-10.1-0.el8.x86_64
gcc-toolset-10-systemtap-4.4-5.el8.x86_64
gcc-toolset-10-systemtap-client-4.4-5.el8.x86_64
gcc-toolset-10-systemtap-devel-4.4-5.el8.x86_64
gcc-toolset-10-systemtap-runtime-4.4-5.el8.x86_64
gcc-toolset-10-toolchain-10.1-0.el8.x86_64
gdbm-1:1.18-1.el8.x86_64
guile-5:2.0.14-7.el8.x86_64
libtirpc-devel-1.1.4-8.el8.x86_64
libzip-devel-1.5.1-2.module+el8.4.0+413+c9202dda.x86_64
ncurses-compat-libs-6.1-9.20180224.el8.x86_64
oniguruma-devel-6.8.2-2.el8.x86_64
perl-B-Debug-1.26-2.el8.noarch
perl-Locale-Codes-3.57-1.el8.noarch
perl-Pod-Parser-1.63-396.el8.noarch
python3-html5lib-1:0.999999999-6.el8.noarch
python3-pydbus-0.6.0-5.el8.noarch
python3-slip-0.6.4-11.el8.noarch
python3-slip-dbus-0.6.4-11.el8.noarch
python3-webencodings-0.5.1-6.el8.noarch
python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
python36-devel-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
redhat-lsb-core-4.1-47.el8.x86_64
Complete!
[root@iZuf6g ~]#
升级成功后,卸载已存在旧的内核。先查看最新内核是否已经安装
查看已存在的内核,最新的内核应该为5.x
rpm -qa | grep kernel
输出如下:
[root@iZuf6g ~]# rpm -qa | grep kernel
warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend.
kernel-devel-5.14.0-162.18.1.el9_1.x86_64
kernel-srpm-macros-1.0-11.el9.noarch
kernel-core-5.14.0-162.18.1.el9_1.x86_64
kernel-headers-5.14.0-162.18.1.el9_1.x86_64
kernel-tools-libs-5.14.0-162.18.1.el9_1.x86_64
kernel-devel-4.18.0-372.9.1.el8.x86_64
kernel-modules-5.14.0-162.18.1.el9_1.x86_64
kernel-modules-4.18.0-372.9.1.el8.x86_64
kernel-tools-5.14.0-162.18.1.el9_1.x86_64
kernel-4.18.0-372.9.1.el8.x86_64
kernel-core-4.18.0-372.9.1.el8.x86_64
kernel-5.14.0-162.18.1.el9_1.x86_64
[root@iZuf6g4xzntqr7ucc5swmkZ ~]#
上面出现警告,我们需要重建rpm仓库
cd /var/lib/rpm
rm -f __db.00*
rpm --rebuilddb
重新运行即可正常,输出存在5.x内核的可以直接卸载旧内核
rpm -e --nodeps `rpm -qa|grep -i kernel|grep 4.18`
输出没有5.x内核的进行内核安装再卸载即可
dnf -y install kernel kernel-core shim
执行dnf命令时,会有如下报错
Last metadata expiration check: 0:01:17 ago on Wed 22 Mar 2023 06:55:50 PM CST.
Modular dependency problems:
Problem 1: conflicting requests
- nothing provides module(platform:el8) needed by module httpd:2.4:8070020230221173330:3b9f49c4.x86_64
Problem 2: conflicting requests
- nothing provides module(platform:el8) needed by module nginx:1.14:8040020210610090123:9f9e2e7e.x86_64
Problem 3: conflicting requests
- nothing provides module(platform:el8) needed by module perl:5.26:8050020211109115414:b4937e53.x86_64
Problem 4: conflicting requests
- nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8060020220513050719:bc93984d.x86_64
Problem 5: conflicting requests
- nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8060020220513153220:9168a43d.x86_64
Problem 6: conflicting requests
- nothing provides module(platform:el8) needed by module php:7.2:8040020210530192442:02bae935.x86_64
Problem 7: conflicting requests
- nothing provides module(platform:el8) needed by module python36:3.6:8050020211109130820:982725ab.x86_64
Problem 8: conflicting requests
- nothing provides module(platform:el8) needed by module virt:rhel:8070020230221174740:3b9f49c4.x86_64
Dependencies resolved.
Nothing to do.
Complete!
将它禁用即可(禁用后重启会自动删除这些不存在的模块),禁用时记得带着版本。
dnf module disable httpd:2.4 nginx:1.14 perl:5.26 perl-IO-Socket-SSL:2.066 perl-libwww-perl:6.34 php:7.2 python36:3.6
再次执行dnf即可正常
系统升级完毕,重启使最新内核生效即可
dnf update -y
reboot
评论 (0)