前言
centos被redhat收購后,centos官方宣布centos linux項目將停止維護,并使用新推出的centos stream項目替代。新版的centos stream項目在軟件更新方式上與centos存在較大差別,具體詳情可查看官方說明。
centos8.3以下版本升級到8.51、注釋mirrorlistsed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo2、指向baseurl至vault.epel.cloud存儲庫sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo3、升級系統(tǒng)至Centos 8.5yum update

centos8升級到centos8stream1、選擇新源dnf --disablerepo '*' --enablerepo extras swap centos-Linux-repos centos-stream-repos2、升級所有軟件包至最新穩(wěn)定發(fā)行版dnf distro-sync3、安裝epel源dnf -y install epel-release4、重啟系統(tǒng)reboot

centos8stream升級到centos9stream1、安裝必要包管理工具rpmconf和yum-utilsdnf -y install rpmconf yum-utils2、處理所有包的配置文件
如果出現(xiàn)提示,直接輸入Y并回車繼續(xù),如果沒提示繼續(xù)第三步操作
rpmconf -a3、移除舊版epel源dnf -y remove rpmconf yum-utils epel-release4、安裝Centos-Stream-9相關的包
安裝過程中有可能出現(xiàn)文件找不到的提示,不用理會直接繼續(xù)
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 all5、執(zhí)行升級Centos-Stream-9的命令dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync6、升級完成后進行相關清理和配置操作#重建rpm數(shù)據(jù)庫 rpm --rebuilddb #卸載Centos-Stream-8的內核,卸載時可能會報錯,一般斷開所有遠程連接后再次運行命令即可 rpm -e --nodeps `rpm -qa|grep -i kernel` #安裝新內核及必要語言包 dnf -y install kernel kernel-core shim #安裝基礎環(huán)境dnf group install minimal-environment -y #安裝epel源、rpmconf和yum-utilsdnf -y install epel-releasednf -y install rpmconf yum-utils #禁用無效module,處理:沖突的請求,此步需要注意根據(jù)具體的沖突的包來禁用 dnf module disable mariadb:10.3 Python/ target=_blank class=infotextkey>Python36 -y #更新系統(tǒng) dnf -y update #再次處理包配置 rpmconf -a

常用優(yōu)化設置1、禁用防火墻等#禁用防火墻 systemctl disable --now firewalld.service #禁用SELINUX setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config2、安裝啟動web控制臺
cockpit是一個交互式 Linux 服務器管理接口,能夠方便的通過web界面來管理Linux服務器的相關硬件資源和服務,以下是相關的安裝和啟動命令。
#安裝 cockpitdnf install cockpit -y #啟動并設置自啟動服務 systemctl enable --now cockpit.socket #安裝相關插件 dnf install -y cockpit-machines cockpit-podman cockpit-composer總結
以上就是centos8升級centos9stream的操作步驟,此操作步驟已經實際驗證過,可以正確運行,請放心使用。






