Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS7 upgrade CentOS8

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Note: the method in this paper has been successfully implemented on Tencent Cloud server. Please back up the important data on the server before specific operation.

Step 1: install the epel repository

Yum install epel-release-y

Step 2: install the yum-utils tool

Yum install yum-utils-y

Step 3: parse the rpm package

Yum install rpmconf-y

Rpmconf-a

Package-cleanup-leaves

Package-cleanup-orphans

Step 4: install dnf

Yum install dnf-y

Step 5: delete the yum package manager and let the dnf package manager take over

Dnf remove yum yum-metadata-parser

Rm-fr / etc/yum

Step 6: use dnf to upgrade the system

Dnf upgrade

Delete the original yum source

Cd / etc/yum.repos.d/

Cp. Repo ~ /

Rm-fr CentOS-*

Step 7: install the CentOS 8 distribution using dnf

Dnf-y upgrade http://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

Cd / etc/yum.repos.d/

Ls

Check to see if the DNF source is centos8

Step 8: upgrade the EPEL repository

Delete the original epel source

Cd / etc/yum.repos.d/

Rm-fr epel*

Upgrade the epel repository for centos8

Dnf-y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Rebuild dnf cache

Clear

Dnf makecache

After the command is executed, check to see if the source of the prompt is CentOS-8-AppStream,CentOS-8-Base,CentOS-8-Extras and EPEL. If not, or if there are other sources, you need to do the above steps again.

As follows:

CentOS-8-AppStream

CentOS-8-Base

CentOS-8-Extras

Extra Packages for Enterprise Linux 8-x86o64

Metadata cache created.

Step 9: after successfully upgrading the EPEL repository, delete all temporary files

Dnf clean all

Step 10: delete the old kernel for CentOS 7

Query which cores are installed

Rpm-Q kernel

Delete according to the output:

Rpm-e kernel-3.10.x68_ 64

Kernel-3.10.x68_ 64 here is the specific package name queried by rpm-Q kernel

If there is a dependency, delete the package that depends on the kernel first

Step 11: delete conflicting software packages

Rpm-e-nodeps sysvinit-tools

Step 12: upgrade the package for centos8

Dnf-y-releasever=8-allowerasing-setopt=deltarpm=false distro-sync

This step is critical. If the dnf source is correct, the package will be upgraded, and if it is incorrect, an error will be reported. You need to delete all files in the yum.repo.d directory and re-perform steps 7 and 8 to reinstall the dnf source.

Step 13: install a new kernel for CentOS 8

Dnf-y install kernel-core

It will not take effect immediately after installation and needs to be restarted.

Step 14: finally, install the CentOS 8 minimum package.

Dnf-y groupupdate "Core"Minimal Install"

This step is a supplement to step 12.

This step may indicate that the installation of the yum package failed, and the solution is to delete the / etc/yum directory and rerun the installation command:

Rm-fr / etc/yum

Dnf install yum-y

Step 15: restart the server

Init 6

Step 16: if the above steps are correct, the system should start normally

After booting, check the kernel with uname, which is already the 4.18 kernel of CentOS 8.

Uname-a

Linux ygj-centos 4.18.0-80.11.2.el8_0.x86_64 # 1 SMP Tue Sep 24 11:32:19 UTC 2019 x86 "64 GNU/Linux

Complete the upgrade

Step 17: enable remote login of root

After the upgrade is completed, the system may prohibit root users from logging in remotely by default, resulting in xshell being unable to connect

Log in to the console of the CVM, use vnc to connect to the server, and then modify the ssh settings

Vim / etc/ssh/sshd_config

Remove the "#" in front of the # PermitRootLogin yes line and restart the sshd service

Systemctl restart sshd

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report