Ubuntu

Build Debian Packages From Source

Debian and Debian-based systems like Ubuntu uses Advanced Package Tool, or APT in short, for installing, updating, upgrading and removing software from command line. Usually, the APT package manager stores the list of repositories in the file named /etc/apt/sources.list and in any file with the suffix .list under the directory /etc/apt/sources.list.d/. When we install a package, apt command retrieves the binary or pre-compiled version of the given package from these repositories. In addition to installing binary packages, APT can also lets you to download the source code of a package. So you can then add some features in the source, build the package from the source code, and finally install the modified version of the package. This guide explains how to build debian packages from source on Debian, Ubuntu and other APT-based systems like Linux Mint.

Why should we build a package from source?

There could be many reasons to build a package from source. Here are a few reasons I could think of now:

  • Inspect the source code to find a bug.
  • Add new features in the packages that aren’t being actively developed any longer.
  • Install the most recent version of a package from source. Generally, the packages in the official repositories might be bit old.
  • And more importantly – learn to build Debian packages from source.

Read More

 

Build Debian Package From Source Tarball, Build Debian Package From Tarball, Build Debian Packages, Build-essential Package Debian Install, Debian Build Package Install, How To Build Debian Packages, Ubuntu Build Debian Source Package

Debian Logo Image

Install Newer Software in Debian

Debian is an excellent Linux distribution, especially for servers. It is also a great distribution to run on a regular desktop computer or laptop. You very rarely encounter a bug on this operating system, and packages integrate exceptionally well with one another.

For example, you can easily switch to a different display/login manager, add another desktop environment or change other key components of your software stack. In contrast, you might get weird conflicts on other distributions when trying to switch default packages.

Here’s the short version, without too many technical details. Once most of the known bugs are removed, packages are frozen to a particular version. Most of them will never receive feature upgrades, only security fixes. This way, no new bugs get introduced, and the distribution can remain “stable.” To be stable means that what worked in a certain way one year ago will work exactly the same way next year on the same version of Debian. The advantage is that you get an operating system that (almost) never “breaks.” You can pull in the latest security fixes, and rest assured that your laptop or computer will work just fine the next day.

You don’t lose a lot by not having the latest version of everything. Most software doesn’t dramatically change in the course of two years. But some software does indeed change often and brings important improvements.

Sometimes, you may even require the latest version of something. This may be the case with a new video card you bought that doesn’t work without the latest driver. For such situations, Debian has a special repository where you can upgrade certain pieces of software that you absolutely need to have.

Here’s how Debian’s official backports webpage describes what back-porting means:

Backports are packages taken from the next Debian release (called “testing”), adjusted and recompiled for usage on Debian stable.

This repository is not enabled by default, but the steps to do so are fairly straightforward.

Open a terminal emulator, and find the codename of your Debian installation:

Linux Terminal Window Enable Backports In Debian

Note: in this example the code-name is “stretch.” If at the time you read this the codename is different, for example “buster,” replace every occurrence where you see “stretch” with “buster.”

Debian’s APT package manager stores the list of repositories where it can download software in a file. View and edit this file with the following command:

At the end of the file, add the following line:

On Debian Buster the line would be: “deb http://deb.debian.org/debian buster-backports main contrib non-free.

Linux Terminal Window Enable Backports In Debian

Your APT sources list might not include the words “contrib” and “non-free.” In this case it means you don’t have some packages available. Among other things, such as the RAR archiver or Steam game platform, you will find drivers for your video card, Wi-Fi adapter and other hardware in “non-free.” If you need these, for example to play 3D video games or if your Wi-Fi isn’t working, enable “contrib” and “non-free.” Simply add the words at the end of each line, after “main.” The following is some text you can copy and paste:

Your sources.list file might also contain different URLs instead of “deb.debian.org.” Use “deb.debian.org,” as it has some advantages. It dynamically redirects you to a server close to you. Since it won’t always redirect you to the same server, there’s another advantage. If you use a static address, such as ” ftp.uk.debian.org/debian/,” if the server goes down, you won’t be able to download packages for that time.

With “deb.debian.org” that should no longer be an issue. It helps a lot, especially if you enable automatic upgrades. With a static server you might notice that your computer hasn’t been automatically updating for days or weeks, while the server was offline.

On some installations the default file “/etc/apt/sources.list” might be missing. In this case sudo apt edit-sources will show an empty screen. Repositories might be stored in a file at “/etc/apt/sources.list.d/base.list” instead. With the following commands, you can see files in that directory and their contents:

When you edit the default sources file with sudo apt edit-sources, don’t repeat the lines you see here. Only add what is missing. Copy the lines from those files, add them to “/etc/apt/sources.list” and then delete the files in “/etc/apt/sources.list.d/.”

Make the package manager pick up on your recent changes and update its database:

Linux Terminal Window Enable Backports In Debian

On Debian 9, codenamed Stretch, to install a newer Nvidia driver from backports, you would use this command:

On Debian 10, codenamed Buster, the command would be:

Linux Terminal Window Enable Backports In Debian apt showing version

It’s not required to use the -V parameter, but it is useful in this case. This makes APT show version strings of the packages that it will install. It makes it easier to spot which packages will be pulled from backports and which will be pulled from regular repositories. Packages that contain the string “bpo” are from backports.

Not all packages have backports available. Only the ones which have important or necessary features in new versions are usually backported. You can quickly check if you can install a newer version for a package with the following command:

Linux Terminal Window Enable Backports In Debian apt policy

In this case you can see that Nvidia’s proprietary driver version 384 is available in Debian’s regular repository. A superior version, 390, is available in backports.

Debian’s list of backported packages can also help you check if a package has a backport available. Remember to adjust the URL in the future with the codename of your current Debian release. “https://packages.debian.org/stretch-backports/allpackages” will be “https://packages.debian.org/buster-backports/allpackages.

Consider upgrading an emergency method from backports. This means don’t overdo it. Install only the packages you really need, otherwise you might make your system unstable or generate conflicts between packages.

Debian Backports, Debian Stretch Backports

Debian 9 Backports Install, Debian Backports, Debian Backports Apt, Debian Backports Install, Debian Backports Jessie, Debian Backports Repository