One of the best things about Linux distributions is that they install software from central repositories using package managers, a concept that other operating systems are just picking up on.

But if you don't frequently update these repositories, your system might run into trouble while installing new packages. Here's why.

Packages Depend on Other Packages

Linux applications, and open-source programs more broadly, make heavy use of shared libraries of code. Because Linux programs use these libraries so widely, it makes sense for Linux distributions to package these the same way they do with executable programs.

The downside of this approach is that the update schedules for programs and their libraries can differ. Developers might make changes to programs or libraries that can significantly alter their behavior.

Complicating the different update schedules, every Linux distribution has its own method for releasing software, with rolling-release distros like Arch releasing packages very soon after the upstream developers come out with their versions.

What Happens if You Don’t Update

If you haven't updated your package repositories, you might run into trouble installing or running new programs that depend on outdated libraries you have installed on your system. Broken packages on Linux are one such implication of outdated packages.

This problem is hardly unique to Linux though. "DLL hell" is a similar problem that Windows users encounter.

How to Update Package Repositories in Linux

Now that you know you need to update package repositories before you install new programs, it's time to learn how to do it. The commands to do so will vary depending on which distro you use.

On a Debian or Ubuntu system, you can update the repository list and upgrade installed packages with APT:

        sudo apt update && sudo apt upgrade
    

On Red Hat derived distros, YUM combines updating package repositories with installing upgraded packages:

        sudo yum upgrade
    

OpenSUSE uses the Zypper package manager. To see which packages need to be updated, type:

        sudo zypper lp
    

To update all the outdated packages, type:

        sudo zypper patch
    

To update an Arch Linux system, use Pacman:

        sudo pacman -Syu
    

Related: How to Install and Remove Packages in Arch Linux

Now Your Software Installation Will Go Smoothly

Now that you know how to update your system before installing new packages, you should run into fewer problems while installing new programs on your Linux system.

The major difference among Linux distros is the package manager. All of them have their strengths and weaknesses, so you should pick the one that matches your working style most closely. Should you use APT, YUM, or Zypper? Or something else entirely? It's up to you.