Upgrading from CentOS 7 to CentOS 8
Updated by Linode Written by Linode
CentOS is a Linux distribution derived from Red Hat Enterprise Linux (RHEL). Some key features new for CentOS 8 are:
- Default desktop environment installation.
- TCP Networking Stack version 4.16.
- Default packet filtering with nftables.
- Improved security with OpenSSL 1.1.1 which includes TSL 1.3.
When upgrading from CentOS 7 to CentOS 8, the cleanest path to migration is to spin up a new installation and move your data. While Red Hat provides an upgrade tool for upgrading to RHEL 8, there is currently no reliable equivalent for CentOS usage. Therefore, upgrading in place is not recommended. This guide will show you how to make the clean install and migration process as quick and easy as possible.
In This Guide
This guide will walk you through the steps to migrate from CentOS 7 to CentOS 8 by:
- Backing up your CentOS 7 installation
- Creating a new CentOS 8 installation
- Mounting your old CentOS 7 backup
- Moving your data to the CentOS 8 installation
- Cleaning Up
Prepare Your Linode
Back Up Your Data
For this guide you will need a backup of your existing CentOS 7 installation. You can back up your Linode in two ways.
- You can enroll in Linode’s Backup Service. This will take automatic regular backups for you, and give you the option of taking a Manual Snapshot at any time.
- For alternative backups solutions, see our Backing Up Your Data guide.
When creating your backup, it’s recommended that you Resize Your Disk to the smallest size possible in advanced in order to ensure that you are able to allocate an extra disk in a later step.
CautionIt is important to note that automatic backups using Linode’s Backup Service will be overwritten after between 8-14 days have passed. If you would like a backup of your Linode to be preserved for a longer time period, it is recommended that you take a Snapshot which will never expire unless manually overwritten.
Create a New Deployment
In Cloud Manager, click on the Linode that currently has CentOS 7 installed.
Click on the Rebuild tab.
From the Images drop down menu, select the CentOS 8 image and enter a Root Password. Optionally, add an SSH key.
Click the Rebuild Button. This will create a new CentOS 8 disk and configuration profile. You can read more about configuration profiles in the Disk Images and Configuration Profiles guide.
Shut down the Linode by clicking on the status icon and choosing Power Off from the drop down menu.
Click the Disks/Configs tab.
Resize the CentOS 8 Disk by clicking the More Options Ellipses and choosing the Resize option from the drop down menu.
Leave enough space to make a new disk for your backup.
Click the Backups tab, followed by the More Options Ellipses next to the backup you created, and select Restore to Existing Linode from the drop down menu.
Note
If your Linode’s disks have been using the entirety of allocatable space available to your Linode, then you will either need to Resize Your Disk so that you can take a new Snapshot, or Resize Your LinodeSelect the current Linode and leave the box for Overwrite Linode unchecked. Then click the Restore button.
This will create two new disks, one for the main disk and one swap, and a new configuration profile. All will have Restore at the beginning of their names.
Move Your Data
Prepare the Disk Configuration
When the restore has completed, click the Disks/Configs tab.
Edit the CentOS 8 Disk Configuration by clicking the More Options Ellipses and choosing Edit from the drop down menu.
The Edit Linode Configuration Panel will open. In the Block Device Assignment section add the Restore CentOS 7 disk to
/dev/sdc
. Click the Submit button to save this change.Click the More Options Ellipses for the CentOS 8 Disk Configuration and select Boot This Config from the drop down menu.
Now you can SSH into your server. Don’t forget to secure your new installation.
Mount the Disk
Use the
lsblk
command to view the filesystem attached to your system.lsblk
The output should look similar to this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 2.1G 0 disk / sdb 8:16 0 512M 0 disk [SWAP] sdc 8:32 0 24.5G 0 disk
Notice how
sdc
doesn’t have a mountpoint specified, this is because it isn’t mounted yet.Mount your old CentOS 7 drive:
mount /dev/sdc /media
Feel free to change the directory to something other than
/media
. However, any content in the directory you choose will be inaccessible while you have a filesystem mounted to it.Check that this was successful by running the
lsblk
command again:sda 8:0 0 2.1G 0 disk / sdb 8:16 0 512M 0 disk [SWAP] sdc 8:32 0 24.5G 0 disk /media
Your files should be listed under the directory
/media
.
Copy the Files
You can copy them with
cp
. For example:cp -r /home/media/home/username/MyFiles /home/username/MyFiles
- The
-r
option tells this to copy directories recursively. Omit this if you only want to copy one directory without its child directories, or if you are copying single files. - The first location is the source on the mounted drive.
- The second location is the destination on your new installation.
- The
Unmount the disk when you are finished copying your files:
umount /dev/sdc
Clean Up
Remove the Backup Disks and Configuration
When you are sure you’ve copied all your files, you can delete the disks and configurations created by the backup restore.
Power down your Linode.
Click the Disks/Configs tab.
Click the More Options Ellipses next to the backup disk and select Delete from the drop down menu.
Do the same for the swap disk and the configuration that was created from the backup restore.
Resize Your Disk
Optionally, you can resize the CentOS 8 Disk to expand to the size remaining on your Linode.
From the Disks/Configs tab, click on the More Options Ellipses for the CentOS 8 disk and select Resize from the drop down menu.
Enter the maximum size allowed as provided under the field.
Click the Resize button.
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.