We use to apt-get the packages to install in Debian derivative of Linux. The packages are mostly downloaded from internet based repositories and locally cached at /var/cache/apt/archives directory. In case we reinstall the Linux, we need to download the packages once again to install through apt-get or synaptic GUI tool. To avoid this situation we can backup the *.deb files available in /var/cache/apt/archives path in some other partition than root. After re-installation, we can create a local repository of these packages to avoid downloading again. Another advantage is that this repository can be shared with other computers too. I personally faced this with Ubuntu 5.10 and here is the step by step HOW-TO for the same.
1. Identify the backup partition and directory for downloaded *.deb files (e.g.: /home/swamytk/packages).
2. $ mkdir -p /home/swamytk/packages/archives/dists/main/mysection/binary-i386
3. $ cp /var/cache/apt/archives/*.deb /home/swamytk/packages/archives/dists/main/mysection/
4. $ cd /home/swamytk/packages/archives
5. $ apt-ftparchive packages . > ./dists/main/mysection/binary-i386/Packages
6. $ cd ./dists/main/mysection/binary-i386/
7. $ gzip Packages
8. Re-install the Linux distribution.
9. Add the following entry in /etc/apt/sources.list file.
deb file:/home/swamytk/packages/archives main mysection
10. # apt-get update
That is it. Now you have all your last downloaded files as local repository. Use apt-get or synaptic to go ahead! Enjoy the beauty of apt-get from Debian.
More posts in this category
- How to access remote linux machine files through SSH from GNOME File browser Nautilus
- How to configure NFS Server and mount it in Ubuntu
- Automated Data backup of Ubuntu Linux using Remote Backup software rsnapshot in Debian
- How to setup Free GPS navigation for Nokia Smartphone without data connection
- Installing Debian GNU/Linux on QNAP TS-110 NAS Box
6 Comments on “Local software repository for apt-get”
You can track this conversation through its atom feed.









Oktyabr says:
Thanks a bunch! Exactly what I was looking for! Now why hasn’t someone built in a simple local command for apt that would retreive dependancies?
Posted on July 27, 2006 at 8:55 am.
Sagar says:
too good! i always wondered if this would be possible!
Posted on February 4, 2007 at 12:42 am.
Ralph Fisher says:
You are the man!
Posted on May 24, 2007 at 11:16 pm.
pftg says:
But this is not good. After this steps you will have not sorted repository. So can you add categorisation to those steps as apt-move?
Posted on June 18, 2007 at 6:13 pm.
nabi niasar says:
Thanks a bunch very GOOD TK
Posted on September 6, 2007 at 4:19 pm.
simon says:
Thanks a lot for your valuable contribution which I was eagerly looking for
Posted on July 31, 2008 at 2:26 pm.