CentOS 8 停止维护,软件源失效

在之前安装宝塔面板的时候,发现CentOS停止维护了,导致官方软件源失效,很多依赖都拉不到包。解决方式有两种:

  • 切换腾讯/阿里软件源
  • 升级系统

当时实在是懒得折腾,于是尝试换源,折腾下来,发现还是各种曲折,但最终算是暂时解决了。

但是一波未平,一波又起,安装后发现宝塔面板的Nignix无法启动,报错:

error while loading shared libraries: libgd.so.2: cannot open shared object....

搜索了资料,得到原因:

这个是因为缺失gd库,把他装上就可以了,最简单的方法即yum install gd

当然使用该命令时,发现找不到gd库,又遇到到麻烦了。

最终,还是决定升级CentOS,以防以后还会遇到各种包找不到,或者依赖的相关问题,这里对升级过程进行一个记录,相对还是非常简单、轻松的

升级Centos Stream过程

首先,输入如下命令,查看你的dnf仓库是否有centos-release-stream

dnf search centos-release-stream

运行结果如图

继续输入如下命令,开始安装centos-release-stream

dnf install -y centos-release-stream

接着,输入如下命令,查看已安装完毕的

dnf repolist

结果如下:

[root@VM-0-5-centos ~]# dnf repolist
Repository AppStream is listed more than once in the configuration
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Repository AppStream is listed more than once in the configuration
Repository BaseOS is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository epel is listed more than once in the configuration
repo id                   repo name
BaseOS                    Qcloud centos OS - x86_64
PowerTools                Qcloud centos PowerTools - x86_64
Stream-AppStream          CentOS-Stream - AppStream
Stream-BaseOS             CentOS-Stream - Base
Stream-extras             CentOS-Stream - Extras
epel                      EPEL for redhat/centos 8 - x86_64
epel-modular              Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                    Qcloud centos extras - x86_64

接着,输入命令,设置默认仓库

dnf swap centos-linux-repos centos-stream-repos

最后同步下仓库(系统安装为8.2版本后,dnf仓库就一直在自动更新,所以最后这个同步命令不运行也可以)

dnf distro-sync

好了,这样就完成了系统升级,查看下自己系统信息吧:

[root@VM-0-5-centos ~]# cat /etc/redhat-release
CentOS Stream release 8

参考

  1. Centos 8完美升级到Centos Stream 8教程 - 冰沫记