centos stream 8 升级 centos stream 9遇到的坑
    文章作者:恒爱网络 阅读次数:1817 发布时间:2022-9-29
    1.安装epel源

    dnf -y install epel-release

    2.更新系统至最新版

    dnf -y update

    3.重启系统

    reboot

    4.安装rpmconf和yum-utils

    dnf -y install rpmconf yum-utils

    5.执行rpmconf ,如果出现一些提示,请输入Y和回车继续,如果没提示继续第四步操作

    rpmconf -a



    6.移除epel源

    dnf -y remove rpmconf yum-utils epel-release

    7.安装Centos-Stream-9相关的包

    rpm -e --nodeps `rpm -qa|grep centos`

     

    rpm -ivh --nodeps --force https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-12.el9.noarch.rpm


    rpm -ivh --nodeps --force https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-12.el9.noarch.rpm


    rpm -ivh --nodeps --force https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-12.el9.noarch.rpm


    dnf clean all

     

    8.升级Centos-Stream-9

     dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync


    执行这条命令会提示失败,首先是提示缺少很多组件,我这个竟然缺少了40多个,所以先一次性禁用


    dnf -y module disable perl-YAML perl-libwww-perl virt varnish swig subversion squid  satellite-5-client  rust-toolset ruby rhn-tools redis python39 python38 python36 python27 postgresql php perl nodejs nginx mysql mercurial maven mariadb mailman llvm-toolset jmc inkscape idm httpd  go-toolset gimp freeradius container-tools perl-IO-Socket-SSL perl-FCGI perl-DBI perl-DBD-SQLite perl-DBD-Pg perl-DBD-MySQL perl-App-cpanminus

    然后reboot重启


    再次 

    dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync 还是无法更新,提示 centos-gpg-keys-9.0-12.el9 无支持。

    只好改成非最佳选项升级:  

    dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync --nobest

    终于开始了更新。


    9.  重建rpm数据库

    rpm --rebuilddb

      rpm -qa | grep kernel 查看安装的内核

    10.卸载Centos-Stream-8的内核

    rpm -e --nodeps `rpm -qa|grep -i kernel|grep 4.18`

    11.安装新内核

    dnf -y install kernel kernel-core shim

     12.安装基础环境

    dnf group install minimal-environment -y

    13.安装epel源、rpmconf和yum-utils

    dnf -y install epel-release

    dnf -y install rpmconf yum-utils

    14.更新系统

     dnf -y update

    15.执行rpmconf,会出现如下界面,一直输入Y和回车即可

    rpmconf -a


    16. 修改设置,核对是否允许root 远程登录

    vi /etc/ssh/sshd_config
    查看下是否有
    
    #PermitRootLogin prohibit-password
    有的话改成
    PermitRootLogin yes
    然后保存。

    不然可能重启后 root 无法远程登录了。



     16.重启系统


    reboot