Local software repository for apt-get

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


6 Comments on “Local software repository for apt-get”

You can track this conversation through its atom feed.

  1. 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?

  2. Sagar says:

    too good! i always wondered if this would be possible!

  3. Ralph Fisher says:

    You are the man!

  4. 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?

  5. nabi niasar says:

    Thanks a bunch very GOOD TK

  6. simon says:

    Thanks a lot for your valuable contribution which I was eagerly looking for

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

RSSSubscribe to Comments on this post



Educate Elevate!

Well said!

If you have to gain all these other "soft skills" or business skills in order to just be a regular software engineer, then why keep working for someone else? One of the main reasons for being an employee is because it's (supposed to be) both easier and safer than striking out on your own. Instead of long hours and having to wear many hats, you can just concentrate on your own skill, and leave the business stuff to the people who specialize in that. Anyone familiar with the idea of specialized labor should understand this. The downside is (supposed to be) your pay is lower than it could potentially be by owning and operating your own business. If today's corporations want their regular rank-and-file employees to wear many hats, be multi-talented, and have a lot of business skills, then they're simply not doing their own jobs correctly. - Grishnakh (Slashdot user)

Archives

Google Page Rank

Creative Commons License
Black God by KaruppuSwamy Thangaraj is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at www.karuppuswamy.com.
Permissions beyond the scope of this license may be available here