Vannkorn

Full Stack Web Developer

Close

Upgrade Ubuntu Server to 24.04 LTS via SSH

Upgrading Ubuntu Server to 24.04 LTS is straightforward if you prepare properly, disable conflicting repos, and test your applications afterward

Ads: Register now via this link to receive $300 credit from Vultr

Upgrading your Ubuntu server to the latest Long-Term Support (LTS) release ensures you stay secure, compatible with new software, and benefit from performance improvements. In this guide, we’ll go through the process of upgrading an Ubuntu server to 24.04 LTS (“Noble Numbat”) via SSH.

1. Preparation

Before touching anything, preparation is key.

Check your current Ubuntu version
lsb_release -a

Or simply

cat /etc/os-release

2. Backup your data

Never upgrade without backups. At a minimum, save:

Web files (e.g., WordPress, apps):
sudo rsync -avz /var/www/ /root/backup-www/
Databases:
mysqldump -u root -p --all-databases > /root/all-databases.sql
Server configs:
sudo rsync -avz /etc/apache2/ /root/backup-apache2/
sudo rsync -avz /etc/php/ /root/backup-php/

Copy backups off the server if possible.

Update current packages

sudo apt update && sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove -y
Check available disk space
df -h

At least 2–3 GB of free space is recommended.

3. Handle Third-Party Repositories

Many servers use external repos (e.g., Nginx, PHP PPAs). These can block upgrades with missing GPG keys.

List them:
ls /etc/apt/sources.list.d/
Temporarily disable them:
sudo sed -i 's/^deb/#deb/' /etc/apt/sources.list.d/*.list

4. Start the Upgrade

Install the upgrade tool if needed:

sudo apt install update-manager-core

Run the upgrade:

sudo do-release-upgrade

If 24.04 isn’t offered yet:

sudo do-release-upgrade -d

Follow the prompts carefully. When asked about config files, it’s usually safer to keep the local version .

5. During Upgrade

The process may take 30 minutes to several hours depending on server speed.

If prompted:

  • Remove obsolete packages? → Generally safe to answer Yes, but review the list.
  • Restart services automatically? → Choose Yes if you’re on SSH.

6. Reboot & Verify

After completion, reboot:

sudo reboot

Check your software versions:

lsb_release -a
apache2 -v
php -v
mysql --version

Confirm services are running:

sudo systemctl status apache2
sudo systemctl status mysql

7. Post-Upgrade Tasks

Update repo entries from jammy (22.04) → noble (24.04). For example, for Nginx:

Remove the # sign from the following lines from the /etc/apt/sources.list.d/nginx.list.distUpgrade

deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/ubuntu noble nginx

Re-import keys if needed:

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg

Then update:

sudo apt update && sudo apt upgrade -y

8. Check PHP compatibility

Ubuntu 24.04 ships with PHP 8.3. If your apps/plugins aren’t ready, install another version (like 8.1 or 8.2) from Ondřej Surý’s PPA. Or you may test your application by visiting your websites or review the logs.

9. Rollback Plan (If Needed)

If something breaks, restore backups:

Files:
sudo rsync -avz /root/backup-www/ /var/www/
Databases:
mysql -u root -p < /root/all-databases.sql
Configs:
sudo rsync -avz /root/backup-apache2/ /etc/apache2/

In case PHP is not upgraded to 8.3, follow the following steps:

Upgrading Ubuntu Server to 24.04 LTS is straightforward if you prepare properly, disable conflicting repos, and test your applications afterward. With careful planning, you’ll benefit from the latest security patches, software updates, and a stable platform for the next five years.

Leave a Reply

Your email address will not be published. Required fields are marked *