If you think Debian package management based is not challenging enough for beginner, maybe you should explore the manual deeper.

Apt command is easy, because it works with already bundled .deb packages. Compared with gentoo’s emerge or arch’s yaourt, there is no need for apt to compile for source.

But again, for curious newbie who wants to know how compilation works in debian, you can use apt-src, or apt-get source command.

Screenshot Summary of Compiling .deb Source

Building Scope


This post will cover the first article, an automatic compilation and bundling of .deb, intended for beginner.

It is actually as simple as issuing just this command.

$ sudo apt-src --build install <your-package>

For beginner, This post give screenshot for each steps.

The second one has lower level, unbundling the first process, the second article won’t covered here.

Command Used

Compared with Arch’s pacman that is a unified command to do all package things, Debian scattered the command into few different command. Debian has dpkg, apt-get, apt-cache, aptitude, apt-src. These day some command has been unified into apt command.

So what you need to read is

$ man dpkg
$ man apt
$ man apt-src

Repository Preparation

Make sure that source repository is enabled in your /etc/apt/sources.list by uncomment the deb-src line.

$ cat /etc/apt/sources.list

Change your /etc/cat/sources.list

you can even uncomment deb in /etc/apt/sources.list and leave you system with source only repository. In this post, we still need deb binary repository to select upgradable package.

Do not forget to update the repository when you are done editing /etc/apt/sources.list by issuing one of this command below

$ sudo apt update
$ apt-src update

Compilation Directory Preparation

Make any directory as a working directory for your compilation process

$ mkdir ~/apt-src
$ cd ~/apt-src

Choose Package to Examine

Let’s choose our victim, see what package is upgradable by issuing this command

$ apt list --upgradable

You can see in figure below, that apt package can be upgraded.

Upgradable Package List using apt

apt 1.2.13 upgradable to 1.2.14.

From now on we will use ‘apt’ package a our focus.

Check Package Version

Simply issue one of this command below

$ dpkg --list apt 
$ apt show apt
$ apt search '^apt$'

Check Package Version with dpkg

Build Package

Let’s do it. This is going to takes time.

$ sudo apt-src --build install apt

Compile and Build using apt-src

This above is the most important part of the process.

You can also unbundling this process into two steps.

$ apt-src install apt
$ apt-src build apt

Examine Directory

Check your directoy, your apt-1.2.14 .deb package should already be there.

List Working Directory for Compiling .deb


Install package using dpkg command

$ sudo dpkg --install apt-1.2.14-amd64.deb

Install .deb Using dpkg

You can check your apt version now

$ apt --version
apt 1.2.14 (amd64)

After a few days, you will feels like compiling is not difficult.

Thank you for reading