How to upgrade CentOS7 to CentOS8 (detailed steps)
This article uses concrete examples to show you how to upgrade the value CentOS 8 from CentOS 7.
Prepare beforehand
Minimize installation of CentOS 7, as shown below: 7.6.1810
[root@liumiao ~] # uname-aLinux devops 3.10.0-957.el7.x86_64 # 1 SMP Thu Nov 8 23:39:32 UTC 2018 x86 "64 GNU/Linux [root@liumiao] # cat / etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@liumiao] #
Step 1: install epel-relase, yum-utils, and rpmconf
Execute the command: yum install yum-utils epel-release-y
The execution log is as follows:
... Omit = Package Arch Version Repository Size=Installing: epel-release noarch 7-11 extras 15k yum-utils noarch 1.1.31-52.el7 base 121kInstalling for dependencies: libxml2-python x862864 2.9.1-6.el7_2.3 base 247k python-chardet noarch 2.2.1-3.el7 base 227k python-kitchen noarch 1.1.1-5.el7 base 267 kTransaction Summary=Install 2 Packages (+ 3 Dependent packages). Omit
Installation command: yum install rpmconf-y
The installation log is as follows:
[root@liumiao] # yum install rpmconf-y... Omit = Package Arch Version Repository Size=Installing: rpmconf noarch 0.3.4-1.el7 epel 21 kTransaction Summary=Install 1 Package... Omit Complete!
[root@liumiao ~] #
Step 2: check before installation
Check the configuration: rpmconf-a
The execution log is shown below, if you choose to use the default settings directly.
[root@liumiao] # rpmconf-a [root@liumiao] #
Check leaf nodes: list packages that are not dependent on other RPM
[root@liumiao] # package-cleanup-- leavesLoaded plugins: fastestmirrorlibsysfs-2.1.0-16.el7.x86_64 [root@liumiao ~] #
Check for packages that are no longer available: list the software packages that are not available for upgrade in the current warehouse
[root@liumiao ~] # package-cleanup-- orphansLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * epel: hkg.mirror.rackspace.com * extras: mirror.bit.edu.cn * updates: ap.stykers.moeGeoIP-1.5.0-13.el7.x8634. Omit yum-plugin-fastestmirror-1.1.31-50.el7.noarch [root@liumiao ~] #
Step 3: install dnf and execute dnf update
CentOS 8 uses dnf as the default package management tool, and uses yum to install its own alternative tool, dnf, and delete itself.
Installation command: yum install dnf-y
The execution log is as follows:
[root@liumiao] # yum install dnf-y... Omit = Package Arch Version Repository Size=Installing: dnf noarch 4.0.9.2-1.el7_6 extras 357 kInstalling for dependencies: deltarpm x86 * 64 3.6-3.el7 base 82k dnf-data Noarch 4.0.9.2-1.el7_6 extras 51 k libcomps x86 * 64 0.1.8-12.el7 extras 75k libdnf x86 * 64 0.22.5-1.el7_6 extras 533 k libmodulemd x86 * 64 1.6.3-1.el7 extras 141k librepo x861364 1.8.1-7.el7 base 81k libreport-filesystem x861364 2.1.11-43.el7.centos base 40k libsolv x86164 0. 6.34-4.el7 base 329k libyaml x861464 0.1.4-11.el7_0 base 55k python-enum34 noarch 1.0.4-1.el7 base 52k python2-dnf noarch 4.0.9.2 -1.el7_6 extras 414k python2-hawkey x86164 0.22.5-1.el7_6 extras 68k python2-libcomps x86164 0.1.8-12.el7 extras 47k python2-libdnf x86164 0.22.5-1. El7_6 extras 608 kTransaction Summary=Install 1 Package (+ 14 Dependent packages)... Omit [root@liumiao ~] #
Clear yum:dnf-y remove yum yum-metadata-parser & & rm-rf / etc/yum
The execution log is as follows:
[root@liumiao] # dnf-y remove yum yum-metadata-parserDependencies resolved.= Package Arch Version Repository Size=Removing: yum noarch 3.4.3-161.el7.centos @ System 5.6m yum-metadata-parser x86161.1.4-10.el7 System 57 kRemoving dependent packages: yum-plugin-fastestmirror noarch 1.1.31-50.el7 @ System 53k yum-utils noarch 1.1.31-52.el7 @ System 337 kTransaction Summary=Remove 4 PackagesFreed space: 6.0 MRunning transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing: 1 Erasing: yum-utils-1.1.31-52.el7.noarch 1, 4 Erasing: yum-plugin-fastestmirror-1.1.31-50.el7.noarch 2, 4 Erasing: yum-3.4.3-161. El7.centos.noarch 3 Erasing 4 Erasing: yum-metadata-parser-1.1.4-10.el7.x86_64 4 Verifying: yum-3.4.3-161.el7.centos.noarch 1 Verifying: yum-metadata-parser -1.1.4-10.el7.x86_64 2 Verifying 4 Verifying: yum-plugin-fastestmirror-1.1.31-50.el7.noarch 3 Verifying 4 Verifying: yum-utils-1.1.31-52.el7.noarch 4/4Removed: yum-3 .4.3-161.el7.centos.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-plugin-fastestmirror-1.1.31-50.el7.noarch yum-utils-1.1.31-52.el7.noarch Complete! [root@liumiao ~] # ls / etc/yumpluginconf.d protected.d vars [root@liumiao] # rm-rf / etc/yum [root@liumiao ~] #
Use dnf update for updates just as you would with yum update.
[root@liumiao ~] # dnf upgradeExtra Packages for Enterprise Linux 7-x86 regions 64 5.6 MB/s | 16 MB 00:02 CentOS-7-Base 3.5 MB/s | 10 MB 00:02 CentOS-7-Updates 2.9 MB/s | 5. 4 MB 00:01 CentOS-7-Extras 40 kB/s | 251 kB 00:06. Omit = Package Arch Version Repository Size=Upgrading: epel-release noarch 7-12 epel 15k. Omit tzdata noarch 2019c-1.el7 updates 493kInstalling dependencies: bind-export-libs x86x632lv 9.11.4-9.P2.el7 base 1.1m geoipupdate x8613642.5.0-1.el7 base 35k Kernel x86 MIs this ok 64 3.10.0-1062.4.3.el7 updates 50 MTransaction Summary=Install 3 PackagesUpgrade 164PackagesTotal download size: 259 MIs this ok [y Unip N]: yDownloading Packages:... Omit Installed: bind-export-libs-32:9.11.4-9.P2.el7.x86_64 geoipupdate-2.5.0-1.el7.x86_64 kernel-3.10.0-1062.4.3.el7.x86_64 Complete! [root@liumiao ~] #
Use dnf to update packages for CentOS 8
The execution log is as follows:
[root@liumiao ~] # dnf-y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpmExtra Packages for Enterprise Linux 7-x86 hours 64 4.3 MB/s | 16 MB 00:03 Last metadata expiration check: 0:00:01 ago on Wed 20 Nov 2019 07:58:07 AM EST. Centos-release-8.0-0.1905.0.9.el8.x86_64.rpm 13 kB/s | 26 kB 00:01 Dependencies resolved.= Package Arch Version Repository Size=Upgrading: centos-release x86 / 64 8.0-0.1905.0.9.el8 @ commandline 26 kTransaction Summary=Upgrade 1 PackageTotal size: 26 kDownloading Packages:Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing: 1 Upgrading: centos-release-8.0-0.1905.0.9.el8.x86_64 1 Cleanup: centos-release-7-7.1908. 0.el7.centos.x86_64 2 Verifying: centos-release-8.0-0.1905.0.9.el8.x86_64 1 Acer 2 Verifying: centos-release-7-7.1908.0.el7.centos.x86_64 2/2Upgraded: centos-release- 8.0-0.1905.0.9.el8.x86_64 Complete! [root@liumiao ~] #
Update epel warehouse
The execution log is as follows:
[root@liumiao ~] # dnf-y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmExtra Packages for Enterprise Linux 7-x86 Base 64 578 kB/s | 16 MB 00:28 CentOS-8-Base 635 kB/s | 7.9 MB 00:12 CentOS-8-Extras 1.7 kB/s | 2.1 kB 00:01 CentOS-8-AppStream 1.3 MB/s | 6.3 MB 00:04 epel-release-latest-8.noarch.rpm 7.7 kB/s | 21 kB 00:02 Dependencies resolved.= Package Arch Version Repository Size=Upgrading: epel-release noarch 8-7.el8 @ commandline 21 kTransaction Summary===Upgrade 1 PackageTotal size: 21 kDownloading Packages:Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing: 1 Upgrading : epel-release-8-7.el8.noarch 1 Verifying 2 Cleanup: epel-release-7- 12.noarch 2 Verifying 2 Verifying: epel-release-8-7.el8.noarch 1 Verifying: epel-release-7- 12.noarch 2/2Upgraded: epel-release-8-7.el8.noarch Complete! [root@liumiao ~] #
At this point, confirm the version information, and it has changed.
[root@liumiao ~] # cat / etc/redhat-release CentOS Linux release 8.0.1905 (Core) [root@liumiao ~] #
Step 4: remove useless files and CentOS 7 kernel and install CentOS 8 kernel
Delete useless temporary files: dnf clean all
The execution log is as follows:
[root@liumiao ~] # dnf clean all62 files removed [root@liumiao ~] #
Delete the old core of CentOS 7: rpm-e `rpm-Q kernel`
The execution log is as follows:
[root@liumiao ~] # rpm-e `rpm-Q kernel` [root@liumiao ~] #
Confirm to delete conflicting packages
[root@liumiao] # rpm-e-- nodeps sysvinit-tools [root@liumiao ~] #
Update CentOS 8 system
[root@liumiao ~] # dnf-y-- releasever=8-- allowerasing-- setopt=deltarpm=false distro-syncExtra Packages for Enterprise Linux 8-x86 Base 64 2.0 MB/s | 3.5 MB 00:01 CentOS-8-Base 160 kB/s | 7.9 MB 00:50 CentOS-8-AppStream 1.6 MB/s | 6.3 MB 00:03 CentOS-8-Extras 950 Bash s | 2.1 kB 00:02 Last metadata expiration check: 0:00:02 ago on Wed 20 Nov 2019 08:09:51 AM EST.Dependencies resolved.= Package Arch Version Repository Size==Upgrading: rpmconf Noarch 1.0.20-1.el8 epel 26k... Omit Removed: deltarpm-3.6-3.el7.x86_64 libselinux-python-2.5-14.1.el7.x86_64 libxml2-python-2.9.1-6.el7_2.3.x86_64 newt-python-0.52.15-4.el7.x86_64 python-2.7.5-86.el7.x86_64 python-chardet-2.2.1-3.el7.noarch python- Firewall-0.6.3-2.el7_7.2.noarch python-kitchen-1.1.1-5.el7.noarch python-libs-2.7.5-86.el7.x86_64 python-linux-procfs-0.4.11-4.el7.noarch python-schedutils-0.4-6.el7.x86_64 python-slip-0.4.0-4.el7.noarch python-slip-dbus-0.4.0- 4.el7.noarch python-urlgrabber-3.10-9.el7.noarch python2-dnf-4.0.9.2-1.el7_6.noarch python2-hawkey-0.22.5-1.el7_6.x86_64 python2-libcomps-0.1.8-12.el7.x86_64 python2-libdnf-0.22.5-1.el7_6.x86_64 pyxattr-0.5.1-5.el7.x86_64 Rpm-python-4.11.3-40.el7.x86_64 systemd-sysv-219-67.el7_7.2.x86_64 Complete! [root@liumiao ~] #
At this point, the kernel state is confirmed by uname-a, which is still 3.10.
[root@liumiao ~] # uname-aLinux devops 3.10.0-957.el7.x86_64 # 1 SMP Thu Nov 8 23:39:32 UTC 2018 x86 "64 GNU/Linux [root@liumiao] # cat / etc/redhat-release CentOS Linux release 8.0.1905 (Core) [root@liumiao ~] #
Since the previous article has been updated, if you execute dnf-y install kernel-core at this time, you will prompt already updated, and then update the relevant package for minimized installation of CentOS 8 by executing the following command:
[root@liumiao] # dnf- y groupupdate "Core"Minimal Install" Last metadata expiration check: 0:13:34 ago on Wed 20 Nov 2019 08:09:51 AM EST.Dependencies resolved.= Package Arch Version Repository Size=Installing group/module packages: dnf-plugin-spacewalk noarch 2.8.5-11.module_el8.0.0+180+337688dc AppStream 24 k dnf-plugins- Core noarch 4.0.2.2-3.el8 BaseOS 59k... Omit [root@liumiao ~] #
Step 5: restart the system
After reboot, you can confirm that the kernel and version file information has been updated.
[root@liumiao ~] # uname-aLinux devops 4.18.0-80.11.2.el8_0.x86_64 # 1 SMP Tue Sep 24 11:32:19 UTC 2019 x86 "64 GNU/Linux [root@liumiao] # cat / etc/redhat-release CentOS Linux release 8.0.1905 (Core) [root@liumiao ~] #
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.