[Centos系统] Centos8/Centos8Stream升级至Centos9Stream,并优化部分设置操作步骤

1147 0
Honkers 2025-3-6 00:06:18 | 显示全部楼层 |阅读模式

目录

前言

centos8.3以下版本升级到8.5

1、注释mirrorlist

2、指向baseurl至vault.epel.cloud存储库

3、升级系统至Centos 8.5

centos8升级到centos8stream

1、选择新源

2、升级所有软件包至最新稳定发行版

3、安装epel源

4、重启系统

centos8stream升级到centos9stream

1、安装必要包管理工具rpmconf和yum-utils

2、处理所有包的配置文件

3、移除旧版epel源

4、安装Centos-Stream-9相关的包

5、执行升级Centos-Stream-9的命令

6、升级完成后进行相关清理和配置操作

常用优化设置

1、禁用防火墙等

2、安装启动web控制台

总结


前言

centos被redhat收购后,centos官方宣布centos Linux项目将停止维护,并使用新推出的centos stream项目替代。新版的centos stream项目在软件更新方式上与centos存在较大差别,具体详情可查看官方说明。

 

centos8.3以下版本升级到8.5

1、注释mirrorlist

  1. sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
复制代码

2、指向baseurl至vault.epel.cloud存储库

  1. sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
复制代码

3、升级系统至Centos 8.5

  1. yum update
复制代码

centos8升级到centos8stream

1、选择新源

  1. dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos
复制代码

2、升级所有软件包至最新稳定发行版

  1. dnf distro-sync
复制代码

3、安装epel源

  1. dnf -y install epel-release
复制代码

4、重启系统

  1. reboot
复制代码

centos8stream升级到centos9stream

1、安装必要包管理工具rpmconf和yum-utils

  1. dnf -y install rpmconf yum-utils
复制代码

2、处理所有包的配置文件

如果出现提示,直接输入Y并回车继续,如果没提示继续第三步操作

  1. rpmconf -a
复制代码

3、移除旧版epel源

  1. dnf -y remove rpmconf yum-utils epel-release
复制代码

4、安装Centos-Stream-9相关的包

安装过程中有可能出现文件找不到的提示,不用理会直接继续

  1. rpm -e --nodeps `rpm -qa|grep centos`
  2. 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
  3. 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
  4. 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
  5. dnf clean all
复制代码

5、执行升级Centos-Stream-9的命令

  1. dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync
复制代码

6、升级完成后进行相关清理和配置操作

  1. #重建rpm数据库
  2. rpm --rebuilddb
  3. #卸载Centos-Stream-8的内核,卸载时可能会报错,一般断开所有远程连接后再次运行命令即可
  4. rpm -e --nodeps `rpm -qa|grep -i kernel`
  5. #安装新内核及必要语言包
  6. dnf -y install kernel kernel-core shim
  7. #安装基础环境
  8. dnf group install minimal-environment -y
  9. #安装epel源、rpmconf和yum-utils
  10. dnf -y install epel-release
  11. dnf -y install rpmconf yum-utils
  12. #禁用无效module,处理:冲突的请求,此步需要注意根据具体的冲突的包来禁用
  13. dnf module disable mariadb:10.3 python36 -y
  14. #更新系统
  15. dnf -y update
  16. #再次处理包配置
  17. rpmconf -a
复制代码

 

常用优化设置


1、禁用防火墙等

  1. #禁用防火墙
  2. systemctl disable --now firewalld.service
  3. #禁用SELINUX
  4. setenforce 0
  5. sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
  6. sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
复制代码

2、安装启动web控制台

cockpit是一个交互式 Linux 服务器管理接口,能够方便的通过web界面来管理Linux服务器的相关硬件资源和服务,以下是相关的安装和启动命令。

  1. #安装cockpit
  2. dnf install cockpit -y
  3. #启动并设置自启动服务
  4. systemctl enable --now cockpit.socket
  5. #安装相关插件
  6. dnf install -y cockpit-machines cockpit-podman cockpit-composer
复制代码

总结

以上就是centos8升级centos9stream的操作步骤,此操作步骤已经实际验证过,可以正确运行,请放心使用。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行