In this tutorial, we will show you how to create an Ubuntu DEB Package. Occasionally, we are dealing with software installation from source code by running configure, make, and make install. When we do it that way, we can not reverse the process (uninstall) it. To overcome that issue, we can build the source code into a DEB Package.
DEB, Debian packages are standard Unix archives that include two tar archives optionally compressed with gzip (Zlib), Bzip2, lzma, or xz (lzma2): one archive holds the control information and another contains the program data. (Source: Wikipedia)
Prerequisites
- A server running one of the following operating systems: Ubuntu Linux.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Create Ubuntu DEB Package from source code
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Create Ubuntu DEB Package.
- DEB builder dependencies
To start building deb
package, we must install several dependencies:
apt-get update apt-get install build-essential automake autoconf libtool pkg-config checkinstall
For this tutorial, I will show you how to build deb
package of Dante Socks Server source code. The file can be obtained here: http://www.inet.no/dante/files/dante-1.3.2.tar.gz
- SSH Command list to build DEB Package
The following are command list to build the Dante DEB package from the source code:
wget http://www.inet.no/dante/files/dante-1.3.2.tar.gz tar zxvf dante-1.3.2.tar.gz cd dante-1.3.2 ./configure make checkinstall
The last command “checkinstall
” will have some responses that you need to input. Once completed it will produce the DEB file: “dante_1.3.2-1_amd64.deb
“
- Install DEB Package
To install this package we can use the standard command:
dpkg -i dante_1.3.2-1_amd64.deb
All done now…
But, if somehow you want to uninstall it, you can do it easily using this command:
dpkg -r dante_1.3.2-1_amd64.deb
Keep in mind that creating a DEB package from source code requires some experience with the command line and build tools. It is also recommended to familiarize yourself with the Debian packaging system and its conventions before attempting to create a DEB package.
Congratulations! You have successfully created an Ubuntu deb package. Thanks for using this tutorial to create a deb package on your Ubuntu 20.04 LTS (Focal Fossa). For additional help or useful information, we recommend you check the official Ubuntu website.