前言
查看centos的版本 ,我这台服务器是虚拟机
[root@localhost ~]#cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]#uname -a
Linux jenkins_server 3.10.0-1160.83.1.el7.x86_64 #1 SMP Wed Jan 25 16:41:43 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# docker run --name my-memcache -m 64 -d docker.io/memcached:1.6.20
/usr/bin/docker-current: Error response from daemon: Minimum memory limit allowed is 4MB.
See '/usr/bin/docker-current run --help'.
[root@localhost ~]# docker run --name my-memcache -m 64mb -d docker.io/memcached:1.6.20
1ad3ad059e1a2f3d179c64f88bd0ec494c46adf78caa9c0f1603e0210b639869
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1ad3ad059e1a docker.io/memcached:1.6.20 "docker-entrypoint..." 3 seconds ago Up 2 seconds 11211/tcp my-memcache
[root@localhost ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1563/mysqld
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 908/redis-server 12
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1160/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 903/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1567/master
tcp6 0 0 :::80 :::* LISTEN 1160/nginx: master
tcp6 0 0 :::22 :::* LISTEN 903/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1567/master
现在可以将 CentOS 7 升级到 Rocky Linux 8。由于 CentOS 8 已经死了,所以将 CentOS 7 迁移到 CentOS 8 是没有意义的。
现在,您不仅可以将 CentOS 7 升级到 Rocky Linux 8,还可以将 CentOS 7 升级到其他 EL 8 衍生产品,如 AlmaLinux、CentOS Stream、Oracle 和 Rocky Linux。
感谢ELevate(https://wiki.almalinux.org/elevate/),一项计划和工具,可以在RHEL衍生品的主要版本之间进行迁移。
在这里,我们将看到如何将 CentOS 7 升级到 Rocky Linux 8。
进行系统备份
在继续之前,我强烈建议您进行系统备份或快照以进行恢复,以防升级后出现问题。除此之外,您还可以先在虚拟机或测试计算机上尝试此升级过程,然后再在实时服务器上执行此升级过程。
如果你的centos7系统未到达最新版本,请进行升级
yum update -y
[root@localhost ~]#cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]#uname -a
Linux localhost 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
升级内核,使用最新内核
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
安装提升
安装提升发布包以配置项目存储库并安装 GPG 密钥。
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
安装 Rocky Linux 的 leapp 软件包和迁移数据。
yum install -y leapp-upgrade leapp-data-rocky
执行预检查
使用以下命令启动升级前检查。此检查将确定操作系统升级的可能性,并报告升级前需要修复的潜在问题。
leapp preupgrade
此外,您还可以在文件中获取有关报告的升级阻止程序(风险因素:高(限制)和建议的解决方案)的详细信息。除了阻止程序之外,该文件还将包含从信息到高的其他风险,您可以查看并进一步进行。/var/log/leapp/leapp-report.txt
处理,根据文件中提升执行命令
[root@localhost ~]# cat /var/log/leapp/leapp-report.txt |grep command
[command] yum -y remove kernel-devel-3.10.0-1160.83.1.el7
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section remove_pam_pkcs11_module_check.confirm=True
Summary: In RHEL 8, there is no 'python' command. Python 3 (backward incompatible) is the primary Python version and Python 2 is available with limited support and limited set of packages. Read more here: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/#using-python3
The postqueue command no longer forces all message arrival times to be reported in UTC. To get the old behavior, set TZ=UTC in main.cf:import_environment.
[root@localhost ~]# yum -y remove kernel-devel-3.10.0-1160.90.1.el7 && leapp answer --section remove_pam_pkcs11_module_check.confirm=True
#再次检测
[root@localhost ~]#leapp preupgrade
升级到 Rocky Linux 8
使用以下命令开始升级。此升级需要一些时间才能完成。下载了一堆包,更新了一堆包
leapp upgrade
1 报错
STDERR:
No matches found for the following disable plugin patterns: subscription-manager
Repository extras is listed more than once in the configuration
Warning: Package marked by Leapp to upgrade not found in repositories metadata: gpg-pubkey
RPM: warning: Generating 6 missing index(es), please wait...
Error: Transaction test error:
file /usr/lib64/.libcrypto.so.1.1.1k.hmac from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/.libssl.so.1.1.1k.hmac from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/engines-1.1/afalg.so from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/engines-1.1/capi.so from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/engines-1.1/padlock.so from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/libcrypto.so.1.1.1k from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
file /usr/lib64/libssl.so.1.1.1k from install of openssl-libs-1:1.1.1k-9.el8_7.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-5.el7.x86_64
============================================================
END OF ERRORS
============================================================
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
Answerfile has been generated at /var/log/leapp/answerfile
2023-06-01 14:19:34.232 ERROR PID: 26818 leapp: Upgrade workflow failed, check log for details
[root@localhost ~]#
2移除openssl11-libs
[root@localhost ~]# yum remove openssl11-libs-1:1.1.1k-5.el7.x86_64
请先备份nginx配置文件在移除
如果上述操作后,再次更新还是原先的报错,那就卸载原先的openssl-libs-1:1.1.1k-9.el8_7.x86_64
3再次升级
leapp upgrade
本文参考
https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-upgrade-centos-7-to-rocky-linux-8.html#:~:text=Upgrade%20CentOS%207%20to%20Rocky%20Linux%208%201,Linux%208%20…%205%20Post%20Migration%20Checkouts%20