Updating Linux: Ubuntu, Fedora, CentOS, Arch

Updating Linux: Keeping your Linux system updated is essential for maintaining stability, security, and getting the latest features. This guide will walk you through updating and upgrading packages and moving to the latest release on several popular Linux distributions, including Ubuntu, Fedora, CentOS, and Arch Linux.

Updating Linux Packages for Ubuntu or Debian

To update Ubuntu, Linux Mint, or other Debian based distributions, follow these steps:

  1. Open a Terminal: Press Ctrl + Alt + T
  2. Get the latest package list:
    sudo apt update

    Updating Linux: Ubuntu sudo apt update

  3. Upgrading Linux installed packages:
    sudo apt upgrade

    Upgrading Linux Packages: Ubuntu uses sudo apt upgrade

    When prompted, type Y to proceed:

    Press Y to continue apt upgrade

  4. Clean up unused packages and cache:
    sudo apt autoremove && sudo apt clean

    sudo apt autoremove && sudo apt clean

    If prompted, confirm by typing Y:

    Press Y to clean

    Note: The autoremove command removes unneeded dependencies, and clean clears cached packages from /var/cache/apt/archives.

Upgrading Ubuntu Distributions

To upgrade to the latest Ubuntu distribution:

sudo apt dist-upgrade

To Upgrade Ubuntu Distributions: sudo apt dist-upgrade


How to Update Fedora Linux

Fedora uses the dnf package manager. Follow these steps to update your system:

  1. Open a Terminal: Open from the Applications menu or by pressing Ctrl + Alt + T.
  2. Refresh and upgrade packages:
    sudo dnf upgrade --refresh

    This command will update the repository metadata and upgrade all installed packages.

  3. Remove unused packages:
    sudo dnf autoremove

    This command will remove packages that were installed as dependencies but are no longer needed.

Upgrading Fedora

To upgrade Fedora to the latest release, use the dnf system-upgrade plugin:

sudo dnf install dnf-plugin-system-upgrade
sudo dnf system-upgrade download --releasever=version_number
sudo dnf system-upgrade reboot

Replace version_number with the latest Fedora release number.


How to Update CentOS Linux

CentOS uses the yum package manager, with commands similar to Fedora’s dnf.

  1. Open a Terminal
  2. Update all packages:
    sudo yum update

    This command checks for available package updates and installs them.

  3. Remove unnecessary packages:
    sudo yum autoremove

    This will remove unneeded dependencies, freeing up disk space.

Upgrading CentOS

CentOS primarily supports upgrades between minor versions (e.g., 8.0 to 8.1). Major version upgrades (e.g., 7 to 8) may require a manual approach or dnf in CentOS Stream.


How to Update Arch Linux

Arch Linux uses the pacman package manager. Here’s how to keep it up to date:

  1. Open a Terminal: Open from the menu or press Ctrl + Alt + T.
  2. Sync package databases and upgrade:
    sudo pacman -Syu

    This command updates the package list and installs all package upgrades.

  3. Remove orphaned packages:
    sudo pacman -Rns $(pacman -Qdtq)

    This removes orphaned packages (dependencies no longer required by any installed package).

Upgrading Arch Linux

Arch Linux is a rolling-release distribution, so there are no separate distribution upgrades. Simply running the following command regularly will keep you on the latest version:

sudo pacman -Syu