目录
前言
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 - sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
复制代码
2、指向baseurl至vault.epel.cloud存储库 - sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
复制代码
3、升级系统至Centos 8.5
centos8升级到centos8stream
1、选择新源 - dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos
复制代码
2、升级所有软件包至最新稳定发行版
3、安装epel源 - dnf -y install epel-release
复制代码
4、重启系统
centos8stream升级到centos9stream
1、安装必要包管理工具rpmconf和yum-utils - dnf -y install rpmconf yum-utils
复制代码
2、处理所有包的配置文件
如果出现提示,直接输入Y并回车继续,如果没提示继续第三步操作
3、移除旧版epel源 - dnf -y remove rpmconf yum-utils epel-release
复制代码
4、安装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
复制代码
5、执行升级Centos-Stream-9的命令 - dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync
复制代码
6、升级完成后进行相关清理和配置操作 - #重建rpm数据库
- rpm --rebuilddb
- #卸载Centos-Stream-8的内核,卸载时可能会报错,一般断开所有远程连接后再次运行命令即可
- rpm -e --nodeps `rpm -qa|grep -i kernel`
- #安装新内核及必要语言包
- dnf -y install kernel kernel-core shim
- #安装基础环境
- dnf group install minimal-environment -y
- #安装epel源、rpmconf和yum-utils
- dnf -y install epel-release
- dnf -y install rpmconf yum-utils
- #禁用无效module,处理:冲突的请求,此步需要注意根据具体的冲突的包来禁用
- dnf module disable mariadb:10.3 python36 -y
- #更新系统
- dnf -y update
- #再次处理包配置
- rpmconf -a
复制代码
常用优化设置
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/config
复制代码
2、安装启动web控制台
cockpit是一个交互式 Linux 服务器管理接口,能够方便的通过web界面来管理Linux服务器的相关硬件资源和服务,以下是相关的安装和启动命令。 - #安装cockpit
- dnf install cockpit -y
- #启动并设置自启动服务
- systemctl enable --now cockpit.socket
- #安装相关插件
- dnf install -y cockpit-machines cockpit-podman cockpit-composer
复制代码
总结
以上就是centos8升级centos9stream的操作步骤,此操作步骤已经实际验证过,可以正确运行,请放心使用。 |