Step by Step Migration from RHEL to Centos
November 16, 2017

Step by Step Migration from RHEL 7.4 to CentOS 7.4

Operating Systems

Considering migration from RHEL 7 to CentOS 7? Start here. 

RHEL vs. CentOS

One of the biggest “selling” points for CentOS is that CentOS is built from the official Red Hat source code. In fact, CentOS’s Git repository, git.centos.org, has officially replaced ftp.redhat.com as Red Hat’s official publication site for Red Hat Enterprise Linux (RHEL) source RPMs. CentOS takes the official RHEL source, strips it of trademarked vendor branding, artwork, and ties to the Red Hat Network, recompiles the binaries, and publishes their distribution. This means that CentOS and RHEL are incredibly, if not entirely, compatible.

According to the CentOS wiki, “CentOS conforms fully with Red Hat, Inc's redistribution policies and aims to be functionally compatible with Red Hat Enterprise Linux.”

Difference Between RHEL 7 and CentOS 7

The primary difference between RHEL and CentOS is that you no longer have to pay for expensive support direct from Red Hat. What you gain is the flexibility to find that support elsewhere, such as from OpenLogic.

For the security-minded, when Red Hat publishes security updates, CentOS quickly turns those updates around and presents them to the CentOS community, usually in about 24 hours or less.

More information about the relationship between Red Hat and CentOS can be found at the Red Hat site here.

While this information is useful if you’re considering migrating your existing services to RHEL or CentOS from another Linux distribution, such as Ubuntu or SUSE, or another operating system, such as Windows, what if you already have RHEL systems that you’d like to migrate to CentOS?

What Is the CentOS Migration Process?

The CentOS migration process doesn't need to be a hassle. You can make it easier. Here's how.

While we can work with you to help plan out the migration and assist in identifying any migration risks before your migration is attempted, if your systems are relatively straightforward installs with very little in the way of customization, you might consider migrating yourself.

Note: Even if you don’t contact OpenLogic to help you plan your migration, if you run into any problems, our support team can help you through the tough times to get you back up and running.

Migrating from RHEL to CentOS, since they are distributions built from the same source, is a lot easier than migrating from a dissimilar distribution or operating system to CentOS. When it comes down to it, what we’re doing is replacing a handful of Red Hat packages with the equivalent CentOS packages and performing a system-wide package update.

Many folks ask, “Does it work?” Yes, it actually works incredibly well! As long as you haven’t heavily modified your RHEL installation, the migration should be fairly painless.

How to Migrate From RHEL 7 to CentOS 7

I’m going using the CentOS Migration Guide, updated for the CentOS 7.4 release, to convert a vanilla RHEL 7.4 installation to CentOS 7.4.

As always, there are risks associated with any system-level change, so we recommend taking a backup of the system immediately prior to attempting the migration, just in case something does go wrong and the system needs to be restored to its present state. We also recommend testing the migration procedure on non-production systems first so that issues can be caught and remedied prior to migrating your production environment. It’s also wise to schedule a larger maintenance window than you think you’ll need to provide an additional buffer in case there are issues in production that were not encountered in non-production.

CentOS provides a Migration Guide online. One more word of caution regarding this Migration Guide is that this document, and therefore the listed package versions, are not necessarily up-to-date. For instance, you would probably need to update the URLs for the centos-release, centos-release-notes, centos-indexhtml, redhat-logos, yum and yum-plugin-fastestmirror packages for these instructions to work.

System migration is ultimately performed via the ‘yum upgrade’ command (CentOS packages have a higher versioning than the same package in RHEL) so not only will your system be migrated, it will be updated simultaneously! Let’s verify that we’re on a RHEL 7.4 system:

How to migrate from RHEL 7.4 to CentOS 7.4: RHEL 7.4 system

Yup… RHEL 7.4. Now, let’s create a temp directory to work inside of:

How to migrate from RHEL 7.4 to CentOS 7.4: Create a temp directory

Let’s make sure that we’ve separated ourselves from the Red Hat Network and that we won’t be using abrt to report crashes to bugzilla.redhat.com. We also need to remove any Red Hat release notes. (There were some warnings on my system that displayed because this is such a minimal install, but I excluded them for brevity.)

How to migrate from RHEL 7.4 to CentOS 7.4: Create a temp directory

We now need to remove the Red Hat release and indexhtml packages, if they’re installed:

How to migrate from RHEL 7.4 to CentOS 7.4: Remove the Red Hat release and indexhtml packages

On some systems, the /usr/share/redhat-release or /usr/share/doc/redhat-release directories may be left, even though they are empty, so we’ll remove them so that they don't cause issues when installing the centos-release package:

How to migrate from RHEL 7.4 to CentOS 7.4: Remove directories

We now download the RPMs that will repoint the yum package manager towards the CentOS mirrors:

How to migrate from RHEL 7.4 to CentOS 7.4: Download the RPMs

Install these RPMs:

How to migrate from RHEL 7.4 to CentOS 7.4: Install RPMs

Let’s clean up yum. We’re primarily interested in purging any cached Red Hat package data so we can repopulate the cache with CentOS data:

How to migrate from RHEL 7.4 to CentOS 7.4: Clean up yum

Now let’s repopulate the yum cache:

How to migrate from RHEL 7.4 to CentOS 7.4: Repopulate the yum cache

Finally, we’ll perform the upgrade using yum. This generates a lot of output for each package being updated so we’ll just show the beginning and end of the sequence here.

How to migrate from RHEL 7.4 to CentOS 7.4: Beginning of upgradesequence

 

How to migrate from RHEL 7.4 to CentOS 7.4: End of upgrade sequence

Finally, we’ll verify that we’re running CentOS 7.4:

How to migrate from RHEL 7.4 to CentOS 7.4: Verify CentOS 7.4

Congratulations!  Our system is now running CentOS 7.4! At this point, if this were a real system, we should reboot and verify that all of our daemons and services are running as expected.

What if Our System Runs an Older Version of RHEL?

Let’s say we have a system that was stuck on RHEL 7.1 because our support contract ran out. Let’s also say that we want to update to CentOS 7.4. We can do that easily, too! What we’d do is download the CentOS 7.1 RPMs (from vault.centos.org since they are not currently available on the CentOS mirrors) and then perform the installs and updates. This will leave us with a CentOS 7.4 system after the update:

How to migrate from RHEL 7.4 to CentOS 7.4: Perform the install

BOOM!  Our RHEL 7.1 system is now a CentOS 7.4 system, complete with all available updates!

Next Steps

Watch this on-demand webinar where we go through this entire migration in less than 5 minutes!

WATCH WEBINAR