How to Upgrade from Ubuntu 22.04 to 24.04: A Step-by-Step Guide

Disclaimer
Please note that this guide is provided as-is, and we do not offer support for the upgrade process. Proceed at your own risk.
Upgrading your Ubuntu server from 22.04 to 24.04 brings a newer LTS base to your Enhance servers. This guide follows a step-by-step approach, with the stable upgrade command and current cPFence v4+ installation instructions.
Set aside a maintenance window and work on one server at a time. You need root or sudo access and a working hosting-provider console in case SSH drops. Check Enhance’s Ubuntu upgrade instructions and Ubuntu’s release-upgrade guidance before starting; an Ubuntu upgrade and an Enhance major-version migration are separate jobs.
Step 1: Take a Full Backup
Before you start, take a full backup of your system. A provider snapshot is useful for returning the whole server to its previous state, but keep separate website, database, mail and configuration backups outside that server too. Check that the backups are readable and that you know how to restore them through the provider console.
Arrange an application-consistent snapshot, pausing writes where your backup method requires it. Restoring an old snapshot also rolls back data written afterward, so decide how you will handle new orders, mail and database changes before reopening services. Start with a low-risk secondary server and check its services before continuing through the cluster.
Step 2: Back Up cPFence Settings, Then Uninstall cPFence
Uninstall cPFence before the upgrade, so its firewall and protection settings cannot interfere with the upgrade. First save a settings backup:
cpfence --backup-cpf-settings
Success reports a file named like cpfence_backup_YYYYMMDDHHMMSS.tar.gz in /var/cpf_backups/. Copy it to your private backup storage. Then uninstall cPFence:
cpfence --uninstall
Read the removal notice and type uninstall to confirm. Protection stays off until you reinstall cPFence in Step 10. Your configuration, license, history and quarantine stay on the server, and reinstalling reapplies your settings.
On the main control panel server with per-website billing, uninstalling suspends the per-website license automatically, so contact support before you start.
If you still use v3, plan the cPFence migration as a separate maintenance task. Do not combine an unfinished product migration with an OS upgrade.
Next, ensure your system’s package manager is healthy. If it reports broken dependencies, review the proposed repair before accepting it:
sudo apt --fix-broken install
Resolve errors before proceeding. Check free disk space, including /boot, and leave enough room for the upgrade’s download and installation estimate.
Step 3: Update Your System
Update your system’s package list and upgrade all packages:
sudo apt list --upgradable
sudo apt update && sudo apt upgrade -y
reboot
Rebooting ensures that all the updated packages are loaded correctly.
Step 4: Prepare for Stability During the Upgrade
Keep the provider console open and retain your current SSH session. The release upgrader may offer a temporary SSH service on TCP 1022. If you use it, temporarily allow that port only from your administrator IP in the existing server firewall and, separately, your hosting-provider firewall. An allow rule does not start an SSH service; test the recovery connection when the upgrader says it is available.
For an already-active UFW firewall, the narrow rule is:
sudo ufw allow from YOUR_ADMIN_IP to any port 1022 proto tcp
Replace YOUR_ADMIN_IP with your own public address. Do not enable UFW or replace another firewall configuration just for this step. Keep a note of each temporary rule so you can remove it afterward.
Step 5: Install the Upgrade Tool
Ensure the release-upgrade tool is installed:
sudo apt install update-manager-core
Check that /etc/update-manager/release-upgrades uses Prompt=lts.
Step 6: Start the Upgrade Process
Begin the stable upgrade:
sudo do-release-upgrade
Confirm that the offered destination is Ubuntu 24.04 LTS. Stay with the interactive prompts and read the changes before accepting them. If no release is offered, resolve pending updates or check Ubuntu’s upgrade availability; do not add -d to force it. That flag is for development releases, as explained in the release-upgrader manual.
If your server uses third-party mirrors, you might need to include the --allow-third-party flag:
sudo do-release-upgrade --allow-third-party
When asked about replacing files under /etc/ufw, Enhance recommends keeping your existing files.
Step 7: Post-Upgrade Cleanup
After the upgrade, you may be prompted to remove old packages. Read the list first. You can postpone removal if you are unsure whether a package is still needed; do not approve removal of a hosting service simply because it appears in the cleanup list.
Step 8: Reboot
Follow the upgrader’s reboot prompt. If you deferred it, reboot after the upgrade has finished:
sudo reboot
Reconnect through SSH or the provider console and confirm the release:
cat /etc/os-release
You should see Ubuntu 24.04. A successful boot is the start of the checks, not confirmation that every hosted service works.
Step 9: Post-Upgrade Adjustments
1. Check and Update Source Lists
After the upgrade, check the enhance.list and docker.list files in /etc/apt/sources.list.d/:
- If
enhance.listhas been renamed toenhance.list.distUpgrade, rename it back. - Do the same for
docker.list.
sudo mv /etc/apt/sources.list.d/enhance.list.distUpgrade /etc/apt/sources.list.d/enhance.list
sudo mv /etc/apt/sources.list.d/docker.list.distUpgrade /etc/apt/sources.list.d/docker.list
In both files, replace any occurrences of jammy with noble:
sudo sed -i 's/jammy/noble/g' /etc/apt/sources.list.d/enhance.list
sudo sed -i 's/jammy/noble/g' /etc/apt/sources.list.d/docker.list
Then, update and upgrade your packages:
sudo apt update
sudo apt upgrade
2. Fix PHP Websites
If PHP websites are not working after the upgrade, reinstall the necessary PHP packages:
sudo apt install --reinstall appcd ecp-php{56,70,71,72,73,74,80,81,82,83,84,85}
Reboot once the package adjustments are complete, then test representative PHP websites, database connections, mail, DNS and backups for the roles on this server. Remove the temporary TCP 1022 rules only after normal SSH works. For the UFW rule above:
sudo ufw delete allow from YOUR_ADMIN_IP to any port 1022 proto tcp
Remove its separate provider-firewall rule too. If services cannot be recovered within your maintenance window, use the agreed snapshot or backup recovery plan, accounting for any writes since that backup.
Step 10: Reinstall cPFence
Retrieve your license key from the client area and reinstall cPFence as root:
bash <(curl -fsSL https://api.cpfence.app/v4/install.sh) -k YOUR_LICENSE_KEY
The installer reapplies the settings kept on the server. Run cpfence --status and confirm an Active license and the expected protection settings. If a setting is missing, restore the backup from Step 2 and check the offered filename before accepting:
cpfence --restore-cpf-settings
Follow the installation guide and read the installer’s final notices. For WebUI access, the provider firewall must separately allow TCP 9095 on the main control panel server and TCP 9096 on every secondary server from the main control panel server’s IPs. cPFence manages the required server-local rules.
Conclusion
A careful upgrade is mostly preparation: reliable backups, working console access and time to check the result. Take it one server at a time, keep your recovery point until the hosted services are verified, and leave the next server for later if anything is unclear.
Happy upgrading!
Keep protection in your upgrade plan.
Explore cPFence v4+ for your Enhance servers, with malware scanning, WordPress protection and server monitoring in one WebUI.
Start your free trial →

