Easy way to create a Debian package and local package repository

This article describes a simple way on how to create a home made debian package and include it into a local package repository. Although we could use a existing Debian/Ubuntu package, we will start from scratch by creating our own minimalistic unofficial debian package. Once our package is ready, we will include it into our local package repository.


This is a companion discussion topic for the original entry at https://linuxconfig.org/easy-way-to-create-a-debian-package-and-local-package-repository

Good article, but the formatting of the code blocks is messed up. They’re all run together as one line.

Great article. Could you make a follow up on updating the debian packages

I was able to create a deb file but on running it shows nothing and I’m at a dead end now.

Hi Ananthu,

Welcome to our forums.

What did you pack into your .deb package? A simple C print-a-line application like the one in the tutorial?

Hi @Lubos, thank you for the article, it was great. I would love to have a .deb with a manpage. Could you please guide me? I would like to add a simple manpage to the distributable. How would you achieve that?

$ sudo dpkg-scanpackages . | gzip -c9 > Packages.gz

bash: Packages.gz: Permission denied

How to solve this?

Hi Ajinzrathod,

Welcome to our forums.

Try this:

$ sudo $(dpkg-scanpackages . | gzip -c9 > Packages.gz)

Or:

$ sudo su
<enter password>
# dpkg-scanpackages . | gzip -c9 > Packages.gz

Thank you for fast answer :smiling_face_with_three_hearts:
Second part worked as a charm :heart:

But while running

sudo apt-get install linuxconfig

Throws an error

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linuxconfig

I tried

sudo apt update
sudo apt-get update
sudo apt install linuxconfig
sudo apt-get install linuxconfig

I even included 2 lines in etc/apt/sources.list

deb [trusted=yes] http://127.0.0.1/debian ./
deb [trusted=yes] http://localhost/debian ./

How can I solve this? :thinking:

Assuming you followed the tutorial, check if your Apache webserver is running:

$ sudo systemctl status apache2

And if not, start it:

$ sudo systemctl start apache2

If the server started, you can try the installation command again. You can check again with the above status command if it started without error, you should see a green “running” sign in the output.