Slow internet ? Always afraid of losing your package downloads ? Cant share the downloaded softwares on your system with your poor friend with no internet connection ?

Ubuntu offers you a recipe to tackle the “re-download phobia”.

Before proceeding , I would like to declare that I am not an Ubuntu guru, just using it for fun and development. Plus, this is my first blog…you might find something distractful, please pardon me for that…and I am always “open” for taking advices…you can see the spirit of “open”-source…. hmm?

This stuff will almost surely (though I havent tested) work on all the Ubuntu variants Kubuntu , Xubuntu, etc.

This blog is pretty elaborative , keeping in mind the nOObs, if you are not one, you can go on with straight with the steps.

Lets get going..

First I will  repeat some simple facts,which you may be knowing already:

1. Ubuntu uses the Debian package management system,so all the installable packages have the extension “.deb” (debian packages) as compared to “.rpm” in RedHat/Fedora.

2. apt (Advance Packaging Tool) and aptitude are tools to help you manage “your” softwares by constant referrals to the “repositories”.Synaptic and Adept are the GUI frontends to apt.

3. The packages you install are first fetched in the location /var/cache/apt/archives/   and are then installed.

You may ask now…

Doesnt it mean that I can share the contents of this file with my friend ?

…well, the answer is ‘yes’ and ‘no’ . This is because the packages are having a lot of “dependencies”. Suppose a package “A.deb” depends on a package “B.deb” for some of its “shared libraries” .Now if you start installing A.deb (by just double-clicking it), you will get “dependency errors”.

You CAN resolve these errors if you anyhow “decipher” the correct order for installation. Let me use my intermediate mathematics here….suppose you have 100 debs ( you will have loads more) i can arrange these in 100P100 ways …wow thats just 100! ways !!! I hope you have a good calculator to get this…

Here enters the “local repository” …

Some precautions to be taken are : empty you ‘partial’ folder in the /var/cache/apt/archives…

you can do it by  having a  complete download of the partial stuff.

Here is the simple way …. I will explain the tools and the new stuff afterwards.

Phase 1:
1. sudo bash
2. cd /var/cache/apt/archives
3. apt-ftparchive packages . > Packages
4. gzip Packages

step 1 , gives you the power of root throughout.

step 2, takes you to the location where the  actual packages are.

step 3, uses a utility called apt-ftparchive for generating the index files, which is read by the package managers.We will come to it later.

‘packages’ option generates the package file from the directory tree of the installed packages.

‘. ‘  denotes that the packages to be used are in the current directory.

‘>’ is the redirector of the output ‘package file’ to a  new file called ‘Packages’ . You can see the entry of this new file in your current directory.

step 4, uses a compression utility called gzip to convert the Packages file to Packages.gz

Phase 2: I will create an example local repository called ‘repo’ in the home directory .We will continue from the last step and i suppose you are still in /var/cache/apt/archives.
1. cp -r * ~/repo
2. cd ~/repo
3. rm lock
4. mkdir -p dists/asiwish/local/binary-i386
5. cd dists/asiwish/local/binary-i386
6. mv ~/repo/Packages.gz .

I dont think the above steps are doubtful…yet some help:

step4 makes a directory called asiwish which means you can give any name(stamp) to it.

step4 also assumes that you are making a repo on and for a i386 machine, replace it with the architecture of your machine.

step4 now finally imports the Packages.gz you made in the Phase1…every repository contains this file as a must.

Congratulations !! You are done….you can now share YOUR repository named repo, with anyone (using the same version as yours and has the same machine architecture).

If you dont know how to add a new is the way :


step1 : sudo nano /etc/apt/sources.list

step2 : add the line “on the top” telling the location of your our case:

deb file:///home/username/repo asiwish local

step3: press ctrl-o , press return/enter key to save, press Ctrl-x to exit

step4 : sudo apt-get update

Hope this was all good and helpful for you, any problems , thrashings (technical as well as design) and ideas are welcome.