Create a local deb repository

If you download a lot of individual deb files and use them over multiple computers a good idea might be to use a central place to store your deb files. if you store them offline and maintain a lot of systems. downloading once and updating your repo will be a lot better than downloading the same deb 100 times.

So in short you can use a server as a local update server.

Have it download packages that are installed on your network pc’s, move them to your repository, rebuild that repository and have the pc’s connect to the local server for updates.

Step by Step

Copy your debian packages to a folder


Generate a Packages.gz file:

dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

Add the new repo to your sources.list

sudo gedit /etc/apt/sources.list
#Personal repository
deb file:/home/user/deb/repo /

# Reload your package index like this:

sudo apt-get update

That’s it a local (or LAN accessible) repository that will help you maintain your systems without having to lose all your bandwith to updates.

Update Script:

It’s annoying to remember the command to rebuild Packages.gz with each update. Simply use a shell script in the deb directory.

Script contents for “”

#must be run as root.
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
echo “”
echo “Package updates completed successfully.”
echo “”

You can now run the command:


and your package list will be updated. You may even want to include a line to copy deb files from your apt archive each time you update using cp or mv.

One Reply to “Create a local deb repository”

Comments are closed.