How do I upgrade CentOS 6.7 to 7?
My Linode is running CentOS 6.7, and I want to install 'docker-ce', but it requires CentOS 7. How can I upgrade to CentOS 7?
There are two ways to upgrade your CentOS:
- Upgrade your deployment directly. For CentOS, there are two steps in this process:
- Run the 'Preupgrade Assistant' tool. This will try to find any problems that might come up when upgrading your CentOS.
- Run the upgrade tool to actually complete the upgrade.
This is covered in more detail in the following Linux Academy link: CentOS 7: Upgrading from CentOS 6.x In Place
If you directly upgrade your CentOS, it's recommended that you take a backup first. The Linode documentation library has a guide which covers different options for backing up: Backing Up Your Data
You could choose to use the Linode Backup Service built into the Linode platform: Use the Linode Backup Service to Protect and Secure Your Data
- Instead of directly upgrading, you can create a new CentOS 7 deployment and then copy your data over. Specifically, you can follow these steps:
- From the Linode's dashboard, follow the 'Deploy an image' link. From this form, deploy a new CentOS 7 image.
- This will create a new CentOS 7 disk, and it will also create a new configuration profile which boots into that disk. Configuration profiles are how you can control which disks and options your Linode boots with:
Disk Images and Configuration Profiles
- From the Linode's dashboard, click the Edit link for the new CentOS 7 configuration profile. In this form, scroll down to the Block Device Assignment section. Here, set
/dev/sdcto be your previous CentOS 6 disk. This will allow you to later mount this disk and copy data off of it.
- Save this change, and then reboot your Linode into the CentOS 7 profile.
- Once your Linode has booted, login via SSH and install all the services you need. Also, be sure to review the security of your deployment and applications:
Securing Your Server
- After you have finished installing your services, mount your old CentOS 6 disk:
- Your old files will then be listed under the
/media/sdcdirectory, and you can copy them to your new CentOS 7 environment using the
Nate's instructions are great and I recently had someone else ask me this same question so I wanted to provide a clear overview of the options:
First, back up your data!
Regardless of your upgrade path, make sure you have all of your data backed up. We also recommend setting up a staging Linode (new or cloned) and not performing any significant changes directly on your production server.
Recommended: Create a new CentOS 7 Linode and copy your files over.
This option provides a clean installation and prevents any unforeseen upgrade issues. This may take more time as you'll need to reinstall your web-server software and copy your files over, but the end result is much cleaner - giving you a chance to do some spring cleaning and install the latest software.
Upgrade "In Place" - meaning upgrading directly from 6.x to 7.x.
This method is not really advisable, but if you must do this you should follow the instructions that Nate provided:
CentOS 7: Upgrading from CentOS 6.x In Place
When taking this route, you should clone your Linode and perform the upgrade on the clone. When you verify that everything works, we can swap the IP of the old 6.x Linode to the new clone with the 7.x upgrade.