1. Overview
One of the design goals of the Debian distribution is to keep everything stable. As such, more recent versions of software and utilities are added more gradually. While Debian may not contain shiny and feature-rich new programs, it makes sense to keep it this way to ensure the reliability of the servers in the long run.
However, there are some cases where we need a more recent version of a software package. For instance, if there is a newly discovered security hole in software that needs an instant security update, then we’ll need to make sure to patch it as early as possible.
So, in this article, we’ll discuss how we can install a more recent version of software on a machine running Debian. First, we’ll cover how we can download and install binaries alongside their dependencies.
Next, we’ll walk through the installation process of Debian Backports, which are packages ported from the “testing” branch of Debian.
2. Manual Installation
Often, there are packages that are standalone — with no need to install external dependencies. For instance, Electron-based applications like Visual Studio Code are mostly standalone executables. Therefore, we just directly download the executable and run it.
On the other hand, some programs depend solely on the system libraries, like the standard GNU C Library and OpenSSL. So, we don’t have to look for dependencies all over the Internet. Fortunately, most of these libraries are available in the Debian package repository that we can install.
Furthermore, some packages are not even available in the Debian package repository, but they are required for a specific use case. In that scenario, we have to either compile the package from its sources or download the compiled binaries and install them.
2.1. Downloading and Running Executables
As an example, we’ll look at the lsd utility, which is a Rust-based ls alternative that offers more features. It only depends on the libc system library, which is already installed on most Linux distributions.
We can simply download the binary from its official repository:
$ curl -LO "https://github.com/lsd-rs/lsd/releases/download/0.23.1/lsd-0.23.1-x86_64-unknown-linux-gnu.tar.gz"
Now, let’s extract it:
$ tar -xvf lsd-0.23.1-x86_64-unknown-linux-gnu.tar.gz
Next, we can move the lsd binary to /usr/bin so it’s readily available for all users:
$ mv lsd-0.23.1-x86_64-unknown-linux-gnu/lsd /usr/bin
Now, let’s test it out:
$ lsd -l --icon never
drwxr-xr-x himhaidar himhaidar 4.0 KB Tue Sep 13 08:30:58 2022 autocomplete
.rw-r--r-- himhaidar himhaidar 11 KB Tue Sep 13 08:30:58 2022 LICENSE
.rw-r--r-- himhaidar himhaidar 4.7 KB Tue Sep 13 08:30:58 2022 lsd.1
.rw-r--r-- himhaidar himhaidar 18 KB Tue Sep 13 08:30:58 2022 README.md
We can do the same thing for packages that require libraries that are not installed on the system. In this case, if we were to use the musl version of lsd, we’d need to install musl first.
Luckily, musl is available in the Debian package repositories so that we can install it beforehand:
$ sudo apt install musl -y
Now, we can use this specific version of lsd that depends on musl. In case the dependency is missing, the program will crash and complain.
Moreover, it’s easy to install recent packages this way, but we should know that over time it gets very complicated. Not only do we need to maintain the package itself, but we’ll also need to maintain the required dependencies.
2.2. Installing DEB Packages
We can somehow remedy this issue by using an installable DEB file. The DEB file contains a metadata file that includes the dependencies required for the package. Therefore, we can use dpkg to install these dependencies from the Debian package repositories and then install the package.
So, let’s download the DEB installable for the musl version of lsd:
$ curl -LO https://github.com/lsd-rs/lsd/releases/download/0.23.1/lsd-musl_0.23.1_amd64.deb
Next, we’ll use dpkg to install the package:
$ sudo dpkg -i lsd-musl_0.23.1_amd64.deb
(Reading database ... 189094 files and directories currently installed.)
Preparing to unpack lsd-musl_0.23.1_amd64.deb ...
Unpacking lsd-musl (0.23.1) over (0.23.1) ...
Setting up lsd-musl (0.23.1) ...
In case dpkg complains about the missing dependencies, we can install the dependencies first using apt-get:
$ sudo apt-get install -f
Then, we can use dpkg to install the package:
$ sudo dpkg -i lsd-musl_0.23.1_amd64.deb
Now, if a more recent version of the program becomes available, we can simply download and install the DEB file. This approach saves us a bit more time as compared to downloading and installing the dependencies manually.
Alternatively, we can also use apt to install the DEB package:
$ sudo apt install ./lsd-musl_0.23.1_amd64.deb -y
With this approach, apt will first fetch and install the dependencies before installing the package. Mind the “./” before the package name because omitting it will result in apt searching for the package in the repository.
One more thing we should keep in mind is that if a package depends on a more recent version of another package than is available on the repository, then we should not force install that package. Doing so will result in broken packages and unmet dependencies.
3. Debian Backports
Backports are recompiled packages from Debian Testing and Debian Unstable, so they will run without new libraries. These packages are mostly new and can be installed if there are security issues with the old ones.
Most of the time, backports will work on Debian Stable without any further setup.
3.1. Adding the Backports Repository
Before installing backports, we need to add the backports repository to the /etc/apt/sources.list file:
$ echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
We added the bullseye-backports repository to the sources. However, we can change it in case we upgrade the Debian system to a newer version. Once our source is added, we can update the package repository:
$ sudo apt update
3.2. Installing Backports
We need to search for the package in the backports repository first. For that purpose, we can either head over to the Debian Package Search page or we can simply use apt:
$ apt show <package-name> -a
We can replace the package name with the canonical name of the package. Afterward, we can simply install the package:
$ sudo apt -t bullseye-backports install <package-name>
4. Conclusion
In this article, we saw how we could install a more recent version of software than is available on the Debian package repository. First, we covered how to install binaries that depend on the system libraries. Then, we discussed how we can install packages that are available as DEB files.
Lastly, we saw what backports are and how we can install backports on Debian Stable.