Creating Debian/Ubuntu .deb packages

In this post, I will show you how to create a .deb package from some binary files.

Step 1: Create the directories

Create a directory for your package. Also, create a directory DEBIAN.

mkdir helloworld && mkdir helloworld/DEBIAN

Step 2: Copy files into your package

You can copy the files into your package with the full paths on the destination filesystem. E.g. if you want to put a file in /usr/local/bin/ you put it in helloworld/usr/local/bin/

mkdir -p helloworld/usr/local/bin cp /usr/local/bin/ helloworld/usr/local/bin/

Step 3: Create the control file

Create a file 'control' in the DEBIAN directory

Package: helloworld Version: 0.2 Maintainer: King Foo Architecture: all Description: hello world
dpkg-deb --build helloworld

This creates a helloworld.deb file, which you can now install on any Debian installation with following command:

dpkg -i helloworld.deb