Debian is known amongst the Linux community for its gold standard in being stable, and a common drawback can be that the packages, especially after the new Debian release ages are that they are often years behind what is currently available as they only receive security and bug updates to keep packages stable. Now for most environments, this is acceptable. Still, it can be very frustrating for users needing specific packages to be upgraded to utilize the features or fix annoying non-critical or security-related bugs. However, the great thing about Linux and using repositories is that you can use what is known as backports or experimental repositories, which are packages taken from the next Debian release, which is nearly always the testing repository and adjusted recompiled for usage on Debian stable.
The following tutorial will demonstrate how to enable the backports, along with an example of how to search and install a package with extra on the same practice with the experimental repository on your Debian 11/10 desktop or server.
Recommended Steps Before Installation
Before proceeding with the tutorial, ensuring your system is up-to-date with all existing packages is good.
sudo apt update
Optionally, you can list the updates for users who require review or are curious.
sudo apt --list upgradable
Proceed to upgrade any outdated packages using the following command.
sudo apt upgrade
Enable Backports Repository
The first step to installing packages from the backports repository is adding them to the sources.list file. To do this, open up your Debian terminal and execute the following command.
sudo nano /etc/apt/sources.list
Go to the end of the file if preferred, and add the following lines; remember to ensure you match the codename of the Debian distribution to your own, or else things will go wrong.
Enable Debian 11 Bullseye backports:
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
Enable Debian 10 Buster backports:
deb http://deb.debian.org/debian buster-backports main contrib non-free
deb-src http://deb.debian.org/debian buster-backports main contrib non-free
Example of what your sources.list may look like:
Save the configuration file (CTRL+O), then exit with (CTRL+X).
Run the apt update command to update the repository list with the new changes.
sudo apt update
How to Install Packages with Backports
Using backports on Debian is very straightforward; the syntax will be similar to installing a standard package except for adding the -t flag.
Search packages from Debian Backports
sudo apt search "package-name" -t bullseye-backports
sudo apt search "package-name" -t buster-backports
Install or Upgrade Packages from Debian Backports
Debian 11 Bullseye example:
sudo apt install "package-name" -t bullseye-backports
Debian 10 Buster example:
sudo apt install "package-name" -t buster-backports
Live example installing Cockpit with Debian 11 example only:
sudo apt install cockpit -t bullseye-backports
The standard Cockpit package is version 239; with the backports, after installing the backports version, the Cockpit package at version 276, which will be even newer as the tutorial ages.
Enable Experimental Repository
For those who love to live on the edge of their seat, you can install the Experimental repository, which can get you the most bleeding-edge updates from Debian; however, this should not be used unless you are on a throw-away test VM or a developer/sysadmin with a purpose needing a package from this repository or an advanced power user that can handle dealing with any issues that go wrong since the changes of incompatibilities is a lot higher.
Re-open your sources.list configuration file, and add the following to the bottom underneath what you previously added.
deb http://deb.debian.org/debian experimental main contrib non-free
deb-src http://deb.debian.org/debian experimental main contrib non-free
Save the configuration file (CTRL+O), then exit with (CTRL+X).
Run the apt update command to update the repository list with the new changes.
sudo apt update
Now, with the t-flag, as you did with backports, you will replace the backports with experimental in your commands.
Search example:
sudo apt search "package-name" -t experimental
Install example:
sudo apt install "package-name" -t experimental
Remember, be cautious using anything from an experimental repository, especially on live production servers or live environments running critical services or production.