From time to time, I build and backport deb packages. Most of them are for my personal use, but sharing them would be nice. Another advantage of setting up a personal repository over directly installing deb files is that you can install dependencies from that repository automatically. This is especially useful if one source package builds multiple binary packages that depend on one another.
There is a list of ways to set up such a personal repository in the Debian wiki. However, I found most of them to be too cumbersome for my limited requirements. The way I’m describing below is probably the simplest and easiest way to get up and running.
The first thing to do is install dpkg-dev, which provides dpkg-scanpackages.
sudo apt install dpkg-dev
Next, put the deb files you created in some local repository, such as /usr/local/debian, and cd into it.
# dpkg-scanpackages -m . | gzip -c > Packages.gz
This will scan all the *.deb files in the directory and create an appropriate Packages.gz file. You need to repeat this step whenever you add new packages to /usr/local/debian.
Finally, to enable the new local repository, add the following line to /etc/apt/sources.list:
deb [trusted=yes] file:///usr/local/debian ./
The [trusted=yes] option instructs apt to treat the packages as authenticated. Alternatively, if you want to share it with others, make sure that your web server serves the directory and point to it:
deb https://www.guyrutenberg.com/debian/jessie ./
(You will need apt-transport-https in order to use HTTPS repositories.)
Don’t forget to apt update before trying to install packages from the new repository.
useful info,
what if i want to call the file from debian 7.8 cli (virtualbox) is it possible ..?
It no longer seems to work in Debian stable 2025 (bookworm). Instead you can change:
dpkg-scanpackages -m . | gzip -c > Packages.gz
to:
ls *deb > override
dpkg-scanpackages . ./override > Packages
Is seems that gzip is causing an issue?