Update/Upgrade your Debian

It is imperative to update as well as upgrade their operating system. It is done to get both new features as well as security updates. In this article, we cover how to update as well as upgrade a Debian through command line interface.

Open Terminal and login as superuser –

su -l

It prompts for superuser’s password. If you don’t have one, then its time to contact your system administrator.

Update your Debian distribution

Once you have successfully logged in, update systems’ repositories –

# apt update

Before updating packages, we must update system repositories. It is essential step in getting the latest version of packages.

To upgrade installed packages, we need to run the following command:

# apt upgrade

After running the command, it provides us with the list of packages that have an upgrade available. View the size of upgrade as well, the space its going to take up etc. When you’re ready, then press Y or n.

After we upgrade our packages, certain packages may no longer be required. And, they take unnecessary space. To remove such packages –

# apt autoremove

Lastly, .deb files for packages we upgrade are saved in directory –

/var/cache/apt/archives/

If you want to remove those .deb files as well then,

# apt autoclean

One of the advantages of keep .deb in the archives directory is – when we no longer need a package we remove it. If the .deb file stay in the archives directory and its the latest version available then, we don’t have to download it again. As the .deb file is already there in the repository.

Upgrading your Debian distribution to newer Release

Till now, we have discussed how to update Debian. When it comes to upgrade, it also means moving from one Debian release to another i.e. from Buster to Bullseye.

We need to first update the sources.list file to move from one stable release to another:

# nano /etc/apt/sources.list

with the following entries:

http://<domain-name>/debian stable main contrib

where,

replace <domain-name> as per present SourcesList configuration.

Then, save and exit. Run the following command:

# apt update

Updating the entries in sources.list file would help us to move to next stable distribution.

Word of Caution: Moving from one stable version to another stable version is possible but, we can’t move from testing and unstable releases to the stable one. So, make sure you are not using the testing/unstable versions of Debian when upgrading to a stable release. If so, then update the sources.list files accordingly.

Now, run the following command to upgrade to next stable distribution:

# apt dist-upgrade

Debian uses a start-stop-daemon program that can restart running packages during a package upgrade.

In conclusion, we have covered here how to update/upgrade a Debian release.

Similar Posts