How to create an Ubuntu package from source

Building from source has never been the most popular choice of the less experienced Linux users who are always in the seek for a pre-built package. This is especially the case with Ubuntu users who like convenience and GUIs over power and terminals. Unfortunately, everything in the Linux world gets first released as source, and then it gets packaged for the various distributions and architectures, meaning that you will most probably never find a package of the absolutely latest version of a software that got just released. Thankfully, building an Ubuntu package is a simple procedure that doesn't require any technical or coding knowledge at all. Here's a step by step guide on how to do it.

Using CheckInstall

First, we need to install the package named “checkinstall” with:

sudo apt-get install checkinstall

We will need this tool in the package building process. After having done this, we need to get the source code of the software that we want to build as a .deb package. In my example, I will use the TerminatorX source code which is an audio synthesizer application for Linux. You can use whatever you want, as long as you make sure that you can satisfy the dependency requirements for it.

Extract the compressed archive and enter the newly created folder and open a new terminal session in it. First command to enter should be “./configure” followed by Enter and the terminal will print out any missing dependencies.

Create packages with CheckInstall on Ubuntu - Step 1

Create packages with CheckInstall on Ubuntu - Step 2

After taking care of all the dependencies by installing additional development libraries in your system, you may proceed by entering the “make” command. This stage may take a while depending on the size of the software that you want to build and the CPU that powers your system. Now the third step is where the package building procedure actually begins. Enter the command “sudo checkinstall” and after inserting your root password, you should see the following options:

Create packages with CheckInstall on Ubuntu - Step 3

You can choose one of the fourteen options offered by checkinstall before starting the package build. For example, you can hit “2” and press enter to change the name of the resulting package, or hit “8” and enter to choose a different source location from the one that the terminal opened in. Let's suppose that I want to change the architecture from the 64-bit one that it currently is to a 32-bit one so that I can install the package in another system as well. I should press “7” and enter and then insert a new architecture type.

Create packages with CheckInstall on Ubuntu - Step 4

The .deb package has been created.

Using Debreate

Debreate is a straight-forward GUI tool with which you can build Debian packages from source. You are simply following a step by step approach adding the package name, version, package maintainer email, a short description and category, etc.

Create packages with Debreate on Ubuntu - Step 1

Then you can set the Files directory and you're basically done. All rest is optional.

Create packages with Debreate on Ubuntu - Step 2

With Debreate, you can set the dependency requirements (step 3) with package naming and version details, include a changelog (step 6), and even set the parameters for the creation of a menu launcher. When all of this is done, you may press that “Start Building” icon on the final step and choose the destination.

Create packages with Debreate on Ubuntu - Finished.

Debreate is a really simple to use and by all means complete Debian package creation tool. While CheckInstall may do the job for when you want to quickly build a package, Debreate can deliver a higher-quality result with no special effort or knowledge requirements.

Share this page:

2 Comment(s)