Debian Stable is extremely stable, but it’s also very slow moving. As a result, you can get stuck with ridiculously outdated software. The backports repositories allow you to install newer versions of some software on your Debian Stable system. This guide explains how to use backports on Debian Stable.

In this tutorial you will learn:
  • How to Add The Debian Backports Repositories.
  • How to Install a Package From Backports.
  • How to Do a Complete Update From Backports.
Install With Debian Backports.
Install With Debian Backports.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian Stable
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How To Add The Backports Repositories



The Debian backports repository and source repository are officially maintained Debian repositories. They just aren’t added to your system by default. There are plenty of applications, like servers, where you wouldn’t necessarily want those repositories available to accidentally install something new. Because of this, though, you’re going to need to add the backports repo manually like you would an external repository.

Add The Debian Backports Repository
Add The Debian Backports Repository.

To start, open up your sources file at /etc/apt/sources.list with your favorite text editor. When you have it open, move to the bottom of the file, and add in the following two lines. You can exclude the source one, if you don’t plan on using it.

deb http://ftp.debian.org/debian stretch-backports main
deb-src deb http://ftp.debian.org/debian stretch-backports main

Feel free to add in the contrib and non-free options too, if you want those packages.

Update Apt for the change to take effect

$ sudo apt update

How To Install A Package From Backports



Debian isn’t going to prioritize the backports repository by default. The assumption here is that you’re going to use backports for new versions of specific packages, but you don’t want to update your entire system. That’s actually a good policy to institute when working with the backports repo, but there’s certainly nothing wrong with installing everything in the repository. It’s all tested to work with Debian Stable.

Install a Package Debian Backports
Install a Package Debian Backports.

When you want to install a package from backports, you can use the -t flag with Apt to specify the backports repo. For example, if you want the latest version of LibreOffice from backports, the command would look like this:

$ sudo apt install -t stretch-backports libreoffice

The repository also includes the latest Linux kernels and Mesa releases. If you’re using an open source graphics stack, these are both vital. If you want the latest kernel on Debian Stable, you can try the following.

$ sudo apt install -t stretch-backports linux-image-amd64

How To Do a Complete Update From Backports



Upgrade With Debian Backports
Upgrade With Debian Backports.

While it isn’t necessarily recommended, you can do an update from backports. This will search trough everything available through the repository and install updates where applicable. It doesn’t mean that Debian will continue to update from backports, though. You’ll have to manually specify it every time. Your normal updates will run as usual, applying new packages from the regular Debian Stable repositories where possible.

$ sudo apt -t stretch-backports upgrade

Conclusion

The Debian backports system should be your first choice when looking for newer packages on a stable install. Because it’s an official Debian repository that’s designed to work with Stable, you have a greatly reduced chance that anything will go wrong. When you pull in external repos, there’s always a chance that something isn’t fully tested. Unfortunately, not everything is available in the backports, so this isn’t always an option, but it’s extremely beneficial to have.

ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions