sudo apt-get install dpkg-dev
sudo mkdir -p /usr/local/mydebs
Previously downloaded Packages are generally stored on your system in the /var/cache/apt/archivesdirectory.
now copy all pkg into /usr/local/mydebs
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
dpkg-scanpackages looks at all the packages in mydebs, and the output is compressed and written to a file (Packages.gz) that apt-get update can read (see below for a reference that explains this in excruciating detail). /dev/null is an empty file; it is a substitute for an override file which holds some additional information about the packages, which in this case is not really needed.
Add to source.list file
add the line
deb file:/usr/local/mydebs ./
You can burn the directory containing the debs to a CD and use that as a repository as well (good for sharing between computers). To use the CD as a repository, simply run
sudo apt-cdrom add
Using the Repository
Whenever you put a new deb in the mydebs directory, run
sudo apt-get update
Now your local packages can be manipulated with Synaptic, aptitude and the apt commands: apt-get, apt-cache, etc. When you attempt to apt-get install, any dependencies will be resolved for you, as long as they can be met.
*To make an offline Repository Over LAN *
# apt-get install apache2
chose to create a directory /var/www/debs/amd64
Create a Packages.gz file
# cd /var/www/debs/
# dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz
Make the repository known to APT
Now the only thing left to do is to let APT know about your repository. You do this by updating your /etc/apt/sources.list file. You’ll need an entry like this one:
deb http://localhost/debs/ amd64/
I used the actual hostname of my system instead of localhost — this way the code is the same for all of the computers on my LAN, but localhost will do just fine if you are running just one computer.
# apt-get update