How to Upgrade CentOS
Editor's Note: CentOS 6 and CentOS 8 are currently end of life, with CentOS 7 set to reach end of life in 2024. This means that upgrading (or downgrading) to CentOS 7 is the only recommended path unless the team has secured long-term CentOS support for the EOL CentOS version being migrated to.Back to top
How to Upgrade CentOS
Ready to get started? Not so fast. First you need to determine the way you need to upgrade CentOS. If you have multiple servers on different versions, it may be that all three situations apply. Below are the three major processes we will use to determine how you should upgrade:
- Upgrading the packages but staying on the same major version (say 7.4 to 7.8).
- Moving from CentOS 7 to CentOS 8.
- Moving from CentOS 6 to either CentOS 7 or 8. If this is your situation, I suggest you move quickly, as CentOS 6 community support ends November 30, 2020.
We will go through all three of these situations at a high level. The high-level overview here is not meant to suggest that OpenLogic cannot guide you through the entire CentOS upgrade process. We certainly can! The problem is that once you consider hardware limitations, networking, security, and application dependencies, we could literally write a book on upgrading CentOS.
The good news is that in most cases you will not need to read a book to actually upgrade CentOS. If you hit roadblocks, reach out!
1. Upgrading CentOS Packages
Yum has been the package manager for CentOS since April 2007. CentOS 8 changes that, at least by default. You can learn more about yum’s replacement, but you almost certainly do not need to know anything about dnf to upgrade your CentOS 8 other than the command below.
Without further ado, to upgrade your packages on CentOS 7 you run:
To upgrade your packages on CentOS 8 you run:
You might need to run su to become the root user, or you may need to run the commands above with sudo in front of them to elevate your privileges.
When you're upgrading CentOS, you may also want to consider configuration management. These are tools such as Puppet, Chef, Ansible, and Salt. You might have some AI that manages containers for you and keep a record of those containers in a blockchain. But this outside the scope of this blog. There are also official CentOS containers on Docker Hub.
If this is your situation, you can do some container storage magic if you need to, and pull down those new containers. This scenario likely means you are updating the container tag in YAML. We have container experts ready to help.
2. How to Upgrade CentOS 7 to CentOS 8
Remember those two things I mentioned in section one that were out of the scope of this article? (It’s ok, they were configuration management and containers.) Well, you can use those to move from CentOS 7 to CentOS 8. They are still out of the scope of this article, and we can still help you with that upgrade!
When you are talking about moving OS levels, another important item is making sure your applications have all of the needed dependencies on the new OS. Although unlikely, this might also be true with a simple ‘yum update’. This is particularly true if you are using third-party repos, but one of the key reasons to use an OS like CentOS is the attempt not to break application APIs in a major version.
What you cannot do is use yum or dnf. Technically, you can find instructions on the Internet for doing this type of upgrade with yum and dnf, but you really should not use those instructions. This upgrade path is not supported by the CentOS developers.
What you need to do in this case is provision a new OS install. In AWS, this would mean launching a new EC2 instance (assuming you aren’t using EKS). This could also mean using ovirt or Terraform. Many of the configuration management tools also have some way to be used as a provisioner.
Once the machine is provisioned, you need to move over any applications and data.
Then, you need to change the DNS to the new server or give your colleagues the new IP address.
3. Moving from CentOS 6 to 7 or 8
At first glance, the logical thing to do might be to move from CentOS 6 directly to 8, but not everything works in CentOS 8 yet. For example, Katello will not support CentOS until March 2021. This is as true of moving from 7 to 8 as it is from 6 to 8, but it is more likely that someone else has already vetted moving to CentOS 8 if you are being asked to upgrade CentOS 7.
It is also more likely that there will be breaking changes in your application with a jump from CentOS 6 to CentOS 8. Still, we cannot recommend moving to CentOS 7 or CentOS 8. It depends on your current situation. If you move to CentOS 7, that means you will have to go through this process again much sooner. If you would like help evaluating whether you should move to CentOS 7 or 8, please let us know!
Aside from having to make the decision about which version of CentOS to upgrade to, the move from 6 to another CentOS is the same as the move from CentOS 7 to CentOS 8. You need to provision a new OS. There is no supported upgrade path between CentOS versions.Back to top
In this blog we looked at three different scenarios for how to upgrade CentOS. For those upgrading packages, or upgrading CentOS versions, the short guides above are a good overview.
If you're dealing with large-scale or complex CentOS upgrades, (e.g. ones that involve issues in hardware, networking, security, or application dependencies) we can help.
- Guide: CentOS for Enterprise
- Datasheet: Enterprise Linux
- Blog - Planning for CentOS EOL
- Blog - CentOS Cheat Sheet
- Blog - CentOS vs. Red Hat Enterprise Linux
- PDF - CentOS 6 Enterprise Support
- White Paper - Decision Maker's Guide to Enterprise Linux