Updated: 11 October 2026 · Applies to: Ubuntu 24.04.5 (apt 2.8.3) and 26.04.1 (apt 3.2.0), Debian 13 (apt 3.0.3), AlmaLinux 10.2 (dnf 4.20) and Fedora 44 (dnf5 5.4.3); the dnf steps also apply to Rocky Linux
To update Ubuntu from the command line, run sudo apt update to refresh the package lists, then sudo apt upgrade to install the newer versions. In one line:
sudo apt update && sudo apt upgrade
Afterwards, reboot if the file /var/run/reboot-required exists. This keeps your Ubuntu release (for example 24.04) and installs its security and bug fixes. Moving to a new release, such as 24.04 to 26.04, is a separate step with do-release-upgrade (see below). Debian uses the same commands; AlmaLinux, Rocky Linux and Fedora use sudo dnf upgrade.
Update Ubuntu step by step
- Open a terminal on the machine, or connect to the server over SSH.
- Refresh the package lists. apt downloads the current lists from the Ubuntu mirrors and tells you how many updates are waiting:
$ sudo apt update ... 3 packages can be upgraded. Run 'apt list --upgradable' to see them.
- See what will change (optional, but worth it on a server):
$ apt list --upgradable libaudit-common/noble-updates 1:3.1.2-2.1ubuntu0.1 all [upgradable from: 1:3.1.2-2.1build1.1] libaudit1/noble-updates 1:3.1.2-2.1ubuntu0.1 amd64 [upgradable from: 1:3.1.2-2.1build1.1] libssl3t64/noble-updates,noble-security 3.0.13-0ubuntu3.16 amd64 [upgradable from: 3.0.13-0ubuntu3.15]
- Install the updates with
sudo apt upgradeand confirm withY(or add-y). Ubuntu 24.04 ends with3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.; the newer apt 3 on Ubuntu 26.04 and Debian 13 prints a summary instead:Summary: Upgrading: 2, Installing: 0, Removing: 0, Not Upgrading: 0 Download size: 2408 kB
- Clean up packages that are no longer needed, such as old kernels:
sudo apt autoremove. - Reboot if needed. After a kernel or core library update,
cat /var/run/reboot-requiredprints*** System restart required ***and/var/run/reboot-required.pkgsnames the packages. Restart withsudo reboot(see Linux reboot command).
The output above comes from our test containers on one day; your package names and counts will differ.
upgrade, full-upgrade and dist-upgrade
sudo apt upgrade: installs newer versions of what you have. According to the apt manual it may install new packages to satisfy dependencies, but never removes any.sudo apt full-upgrade: does the same, but may also remove packages when that is needed to upgrade the system as a whole. Use it when updates stay held back.apt dist-upgrade(andapt-get dist-upgrade) is the older name for full-upgrade. Despite the name, it does not move you to a new Ubuntu release; in our 24.04 test it gave exactly the same result as full-upgrade.
In scripts and cron jobs, use apt-get: apt 3 prints WARNING: apt does not have a stable CLI interface. Use with caution in scripts. when its output is not a terminal.
Kept back and deferred due to phasing
Ubuntu releases some updates in phases: first to a small share of machines, then to everyone if no problems show up. Updates your machine is not yet due for are listed under The following upgrades have been deferred due to phasing: (apt 2.8 on Ubuntu 24.04) or Not upgrading yet due to phasing: (apt 3 on 26.04). Nothing is wrong; they install on a later run, usually within days. Ubuntu’s server documentation advises against forcing them and only adds -o APT::Get::Always-Include-Phased-Updates=true right before a release upgrade. If packages are kept back for another reason, sudo apt full-upgrade usually installs them.
Update Ubuntu automatically
- Security updates: the
unattended-upgradespackage installs them every day. Theubuntu-serverpackage recommends it, so standard server installs have it; elsewhere runsudo apt install unattended-upgrades. It is switched on by/etc/apt/apt.conf.d/20auto-upgrades:APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1";
Automatic reboots are off by default:Unattended-Upgrade::Automatic-Reboot "false";is commented out in/etc/apt/apt.conf.d/50unattended-upgrades. Set it to"true", withAutomatic-Reboot-Time "02:00", only if a nightly restart is acceptable. - Snap packages update themselves: according to Canonical, snapd checks for updates four times a day.
snap refresh --listshows pending updates andsudo snap refreshinstalls them now.
Upgrade Ubuntu to a new release
- Back up the server, or take a snapshot.
- Install all updates for your current release and reboot if asked:
sudo apt update && sudo apt full-upgrade. - Check that a new release is offered:
do-release-upgrade -c. On our Ubuntu 24.04 test it printedNew release '26.04.1 LTS' available. - Start it with
sudo do-release-upgrade, ideally inside tmux or screen so a dropped SSH session does not stop it.
According to Ubuntu, an LTS server is offered the next LTS only after its first point release, and you cannot skip releases. LTS servers look only for LTS releases because of Prompt=lts in /etc/update-manager/release-upgrades. Full guide, including what changes in 26.04: Ubuntu 26.04 LTS and how to upgrade. Debian 12 to 13: upgrade to Debian 13 Trixie.
AlmaLinux, Rocky Linux and Fedora (dnf)
sudo dnf check-update # list updates (exit code 100 = updates available) sudo dnf updateinfo list --security # only the security fixes sudo dnf upgrade # install everything sudo dnf upgrade --security # install only security fixes sudo dnf needs-restarting -r # exit code 1 = reboot needed
In our AlmaLinux 10.2 test, dnf check-update exited with 100 and listed 12 updates, including glibc and openssl-libs; dnf updateinfo list --security showed them as advisories such as ALSA-2026:76918 Important/Sec. yum update still works because yum is a link to dnf (dnf-3 on AlmaLinux 10, dnf5 on Fedora 44). dnf history lists every transaction and sudo dnf history undo ID can roll one back: see dnf history.
For automatic updates on AlmaLinux and Rocky Linux, install dnf-automatic. Its default configuration only downloads updates (apply_updates = no); sudo systemctl enable --now dnf-automatic-install.timer installs them as well. Fedora moves to a new release with dnf system-upgrade. More on Fedora: update Fedora from the terminal.
Update safely
- Back up first, or take a snapshot, especially before a
full-upgradeor a release upgrade. - Update at a quiet time and reboot when asked, so the new kernel and libraries are really in use.
- Read the list before you confirm, and be careful with what your sites depend on, such as PHP, the database server and Docker. To keep one package at its version, see hold packages with apt.
- If an update is interrupted, see recover an interrupted apt or dnf transaction.
Managing many servers: update all packages with Ansible. Rather not do it yourself? Our Linux server management keeps servers patched.
