DEV Community

Cover image for Creating Debian Packages: A Quick Guide
rodit-org
rodit-org

Posted on

Creating Debian Packages: A Quick Guide

Creating your own Debian packages is simpler than you might think. Here's a streamlined approach to get you started quickly.

Basic Setup

First, you'll need the essential tools:

sudo apt install build-essential devscripts debhelper
Enter fullscreen mode Exit fullscreen mode

Package Structure

Create your package directory structure. At minimum, you need:

your-package/
├── debian/
│   ├── control
│   ├── changelog
│   ├── rules
│   └── compat
└── [your source files]
Enter fullscreen mode Exit fullscreen mode

The debian/control file describes your package, changelog tracks versions, rules defines the build process, and compat specifies the debhelper compatibility level.

Building the Package

Once your debian directory is properly configured, building is straightforward:

dpkg-buildpackage -us -uc
Enter fullscreen mode Exit fullscreen mode

The -us -uc flags skip signing the source and changes files, which is perfect for local development and testing. This command will create your .deb file in the parent directory.

Testing

Install your package locally to test:

sudo dpkg -i ../your-package_version_architecture.deb
Enter fullscreen mode Exit fullscreen mode

That's the essence of it. While there are many nuances to packaging, this approach using dpkg-buildpackage -us -uc provides a reliable foundation for creating functional Debian packages.

For a more comprehensive guide with detailed examples, check out this excellent tutorial on creating deb packages.

Top comments (0)