There is no doubt that CentOS has been a very popular choice for developers and Linux enthusiasts to serve websites and apps. However, everything that begins, ends! The same is the case with CentOS 7. There is an obvious reason why an OS might go end of life, however, the cPanel & WHM control panel also announced its role in supporting CentOS 7. In such situations, there are minimal alternatives but upgrading the OS is the best course of action. You might wonder, how you would go about upgrading your CentOS 7 thus we bring you how to upgrade from CentOS 7 to Alma/Rocky Linux.
In today’s post, we are going to check why is CentOS 7 going EOL?, what is cpanel Elevate project and why it is ending Support?, what prerequisites are before upgrading, and how to migrate CentOS 7 to Alma or Rocky Linux. Without further due, let’s begin.
Why is CentOS 7 going EOL?
CentOS 7 is a Linux distribution that has been used in both production and testing environments. CentOS 7 launched back on 7 July 2014 and is the closest clone of RedHat Enterprise Linux. Since it has been in the market for quite a long time, a lot of companies have settled down for this distribution. The reasons might be due to the simplicity of the open source and diverse community support. CentOS has been in collaboration with RedHat since 2014. The distribution is independent but is a legal partner with RedHat, for various business goals. CentOS decided to shift all of its investments to its Stream version called CentOS Stream. This shift has caused the CentOS 7 to go end of life on June 30, 2024.
What is the cpanel Elevate project and why is it ending Support?
Since CentOS 7 is going EOL, cPanel Inc. has decided to stop its support for the OS too. As per the reports, the cPanel & WHM version 110 is the last version that will support CentOS 7. The supported date for cPanel & WHM is the same as the OS EOL date which is June 30, 2024. This means you would not be able to use new cPanel versions but to stay on outdated versions.
This might also halt your system from being up and running and its overall integrity. The best solution is to upgrade the OS in such cases. But the upgrading process means opting for a new server and migrating the content over in most cases. This is a bit of a hassle since it involves factors like cost, downtime, re-setup, and manual migration of content.
cPanel Elevate Project is a process that would help you migrate from CentOS 7 to Alma 8 or Rocky 8 Linux distribution. cPanel Elevate project is provided by the AlmaLinux OS Foundation. It can take a good 30 to 90 minutes to upgrade and services would be down however if things happen as they expected, this is the best way to migrate the Server over.
Presiquites before upgrading
Before you upgrade to Alma or Rocky Linux, there is some risk involved. The risk can be like losing content or a system crash due to an unsuccessful or incomplete upgrade. We suggest that you back up the entire server content before going further on performing the steps. You might want to keep the backups downloaded to your local drives using FTP.
Step 1) Backup
For WHM users
If you own a fully managed Server, then you might get the benefits of on-demand backup and restoration. To get the ease of backup on a fully managed Server, contact your server provider. If you have a server with a WHM control panel, then you would need to back up your server by following the below steps. We are going to use scripts/pkgacct
the facility to archive the cPanel accounts. For this, you would need to log in to your server using SSH as the root user. If you have a Gitbash or Putty installed, connect to the server. We have already covered this, you can check the link here on how to connect to your Linux server.
Individual cPanel account
If you have a single cpanel account and you wish to backup, run the below command
/usr/local/cpanel/scripts/pkgacct username /home/username/destination-backup-directory
Ensure to change the username with your actual cPanel which you want to get a backup of. The destination backup directory can be a directory where it would be put the archived file.
Multi-cpanel account
If your server hosts multiple cpanel accounts and you wish to backup them all, you need to write a bash script to do so and get it done. Below is a sample bash script however you can learn more about pkgacct
it here.
#!/bin/bash
# Set the directory where cPanel user accounts are located
cpanel_dir="/home"
# Iterate through user directories in /home
for user_dir in "$cpanel_dir"/*; do
if [ -d "$user_dir" ]; then
# Extract the cPanel username from the directory path
username=$(basename "$user_dir")
# Skip known system accounts like 'cPanelInstall' and 'root'
if [ "$username" != "cPanelInstall" ] && [ "$username" != "root" ]; then
echo "Processing user: $username" # Debugging line
# Run the pkgacct command to create a backup for each user
/usr/local/cpanel/scripts/pkgacct "$username" "/home/techd/public_html_sands"
# You can replace "/home/techd/public_html_sands" with the actual backup destination directory
fi
fi
done
echo "Backup process completed."
For this approach, you need to know how the bash scripting and execution works, to learn it, check the external article here. Once you have the backup completed, take that backup to your local directory using FTP for safety purposes and then proceed to further steps.
Step 2) System Check
You must verify if there are some incomplete transactions or if the system is out of date. Please consider running the below commands. Login to your Server using SSH, once you are in, follow the below steps.
Complete pending transaction
yum-complete-transaction
Ensure the system is up to date
/usr/bin/yum update -y
Then you might just want to do a reboot before making any other changes.
reboot
After these safety checks are done, navigate to the further section on how to upgrade to Alma or Rocky as below.
How to migrate CentOS7?
In this section, we will be actually performing the upgrade steps for Alma or Rocky. The first thing is to download the cpanel elevate script and then verify if we have any issues prior to the upgrade, by running the below check upgrade command. When you run the final upgrade command, the entire process is of 5 stages. You can check the official documentation page for a proper understanding of the commands here.
Download the cPanel Elevate script
wget -O /scripts/elevate-cpanel \
https://raw.githubusercontent.com/
cpanel/elevate/release/elevate-cpanel;
chmod 700 /scripts/elevate-cpanel
Final system check
Next is to check the upgrade possibility. We are trying to upgrade to Alma Linux hence we have run the Alma upgrade check script, if you wish to use Rocky, run the below command instead.
/scripts/elevate-cpanel --check --upgrade-to=rocky
/scripts/elevate-cpanel --check --upgrade-to=almalinux
When you run the command for a system check, you will get a list of packages or unsupported repositories which you would need to take care of before upgrading to avoid any failure of the task. You would get the list of issues in the output of the command only. Note down what error is shown or what corrections it asks to make. In our case, we were getting issues about having some unsupported packages and repositories which we needed to disable. We have achieved this by following below commands.
yum list installed | grep the-package-name
yum remove package-name -y
yum repolist enable
ls -lah /etc/yum.repos.d/
Note: Note the repo name properly and then edit it, remember that we got this conclusion about which repository is unsupported from the command we ran to check the Final system check before the upgrade. This would let us know what is an unsupported repo and disable it or remove it.
vim /etc/yum.repos.d/repo-in-question
change
Enable from 1 to 0
:wp!
yum clean all
Once you have done this re-run the script and you should get the final confirmation from the script shared in the above screenshot. If you still face any issues, you might want to check this fix in the GitHub discussion here.
Run upgrade script
/scripts/elevate-cpanel --start --upgrade-to=almalinux
We are trying to upgrade to Alma Linux thus we are running the above command, to upgrade to Rocky Linux you would need to run the below script.
/scripts/elevate-cpanel --start --upgrade-to=rocky
As per the Elevate project, this upgrade could take 30 minutes and multiple reboots would happen in the system which would make it unavailable for some time. This means that you ensure you upgrade the server accordingly.
/scripts/elevate-cpanel --status
As shared earlier, as soon as you run the upgrade script the stages begin to start during this time the server will reboot multiple times. The SSH session will be stopped, but worry not, you can re-login to the SSH session to verify the progress. For checking the upgrade status you can run the below script as shared in the screenshot and below it. The entire process might take 30 minutes, but if the server is light, it might just take 10 minutes.
cat /etc/redhat-release
Once all processes are completed, you will get a success message and you can check the OS by running the redhat-release command. That’s how you upgrade from CentOS 7 to Alma or Rocky Linux. Note that you would be getting the Alama 8 or Rocky 8 version with this upgrade both of these Linux would get support until 2029.
Conclusion
Users took a lot of time to switch from CentOS 6 to CentOS 7. Now since the CentOS project decided to go with the CentOS Stream and end its famous CentOS 7 distribution, this upgrade blog might help them move to Alma or Rocky Linux. We hate to see things change, but change is the only constant to perfection. This concludes how to migrate CentOS 7 to Alma/Rocky Linux. What Linux distribution do you prefer, and why? do let us know in the comments section below. If you got any error in the upgrade, want any help, or have any suggestions to make, then do reach us via the contact page here. Happy Columbus Day!
One Response
Good work!!
Appreciate it!!