How to update Debian?

In this tutorial, we will explain a little bit more about the Debian OS and how to update it.

What is Debian?

Debian also known as Debian GNU/Linux is a Linux distribution composed of free and open-sourced software. At the moment we were writing the post the latest stable version of Debian was Debian 12.6. This stable branch is most popular for personal computers and Linux servers. Debian is the oldest operating system based on the Linux kernel ahead of Ubuntu, CentOS, AlmaLinux, and many more Linux distros, and is their parent distribution. Debian emphasizes stability, is user-friendly, and has a massive community of developers.

There are many reasons, why you should use Debian. It is written in 70 different languages and of course of them are the most common programming languages: Plain C, Go, Perl, Python, Ruby, Bash, etc. As a robust and flexible operating system, it is used in many fields for security and stability, software development, package management, system recovery, etc.

The advantages of using Debian are that is very stable and secure, compatible, open-sourced, strong support, and a large community of developers.

In the next paragraphs we will explain to you what are Debian updates, why is important to update it, and how to do it. Let’s get started!

Why Update Debian?

One of Debian’s goals is to provide a consistent upgrade path and secure update process. After every fresh installation of the Debian OS, or once a month of the existing server with Debian OS, it is recommended that the packages be updated to the latest versions available. Of course, sometimes, the OS itself will alert the user for the new release of the packages that will need immediate attention. System administrators should pay attention to these processes so that their systems are always reliable and there are no vulnerable software versions. Updating the Debian OS is very important so the system won’t be exposed and hacked shortly.

How to update Debian?

There are several ways to update the Debian OS. You can update the Debian OS with aptitude, apt-get, apt-cdrom or automatically update with cron-apt.

Aptitude is the recommended package manager to update the Debian Linux system. To update the Debian with aptitude, you have to open the following file:

sudo nano /etc/apt/sources.list

And paste the following line of code:

http://ftp.us.debian.org/debian stable main contrib

Of course, you can change the download mirror to a faster one near your location. Once the line of code is added, save the file, close it, and execute the following commands:

aptitude update

aptitude full-upgrade

If you receive output like this:

root@host:~# aptitude update
-bash: aptitude: command not found

You will have to install the aptitude command with the following:

sudo apt-get install aptitude

Another way to update the Debian OS is with the apt-get, an APT-based command-line tool. To update the system packages to their latest versions available, you need to execute the following command:

sudo apt-get update && sudo apt-get upgrade

We mentioned that the system can be updated with the apt-cdrom command. This is when you want to use CDs and DVDs to install packages. If you execute the command apt-cdrom in your command line, you should receive the following output:

oot@host:~# apt-cdrom
apt 2.6.1 (amd64)
Usage: apt-cdrom [options] command

apt-cdrom is used to add CDROM's, USB flashdrives and other removable
media types as package sources to APT. The mount point and device
information is taken from apt.conf(5), udev(7) and fstab(5).

Most used commands:
  add - Add a CDROM
  ident - Report the identity of a CDROM

See apt-cdrom(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).

You will get a list of commands related to this command and how to use it. Updating Debian OS is rarely done with the apt-cdrom command, only in exceptional cases that we will not dig into.

The last option to update the system is automatic updates, done with the apt-cron command. This tool updates the system at regular intervals using a cron job. By default, it updates the package list and downloads new packages without installing them. Automatic upgrades are not recommended on unstable systems, which may remove packages without notice.

That was it — that was all for updating Debian OS. If you liked this post about updating Debian, please share it with your friends or leave a comment below.

Leave a Comment