Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have a terribly limited download allowance and have multiple computers. So, my questions folks is. Would I be able to save what has been installed thru apt-get and any other terminal installations I attempt?

share|improve this question

marked as duplicate by Braiam, chronitis, BuZZ-dEE, Eric Carvalho, minerz029 Jan 23 at 0:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
see askubuntu.com/questions/123411/… –  Rinzwind Jan 21 at 9:02

2 Answers 2

up vote 1 down vote accepted

Assuming you have a server/spare box, you can setup Apt-Cacher, which will store all of the .deb files for you.

share|improve this answer

When you install a package using apt-get corresponding deb files are downloaded in your /var/cache/apt/archives. Unless user deletes them all those files should be there. You can copy and preserve them for future use.

All you need is to set a local repository[Source]. Then you could install all those packages as usual using apt-get from it. Make a folder localrepo say at you home directory and put all the .deb files from /var/cache/apt/archives in it.

$ mkdir ~/localrepo
$ cp /var/cache/apt/archives/*.deb .

Next you need to create an index file for your repository. For that you need to install dpkg-dev (on your source machine only).

$ sudo apt-get install dpkg-dev

To create index file,

$ cd ~/localrepo
$ dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

It will create an index file named Packages.gz in ~/localrepo. In future you just need to copy the whole ~/localrepo to other machines where you want to install. If you modify the deb files in ~/localrepo you also need to update the index file.

Now you need to show apt-get the repo editing your source list in all machines where you want to install packages from your local repository. First backup your original source.list

$ sudo cp /etc/apt/source.list /etc/apt/source.list.original
$ sudo gedit /etc/apt/source.list

Write the following line in it and save,

deb file:/home/<user_name>/localrepo ./

Replace <user_name> with your exact user name. Now you are ready to install any package that exists in your source machine.

sudo apt-get update
sudo apt-get install <package_name>

You may need to give additional affirmation. As the repository is not trusted. For home use purpose it should be just enough as creation of a trusted repo requires quite a lot extra efforts. But your software center will not probably work with untrusted repo. But the advantage is that it will take care of all the dependencies for a package by itself.

If your /var/cache/apt/archives in your source machine do not contain any package. You can download deb files for all your existing packages using the following command in terminal,[Source]

dpkg -l | grep "^ii"| awk ' {print $2} ' | xargs sudo apt-get -y install --reinstall --download-only
share|improve this answer
    
That is a beautiful response my man. After looking thru the directory /var/cache/apt/archives/*.deb, I wanted to ask, is there a way of seperating updates from this as well? –  Miphix Jan 21 at 22:05
    
@Miphix I could not see an easy way right now. It may be another good question. –  souravc Jan 22 at 2:37
    
Just remember me if you brew up something. Ooh, is there a way of cataloging and indexing these installations? –  Miphix Jan 22 at 2:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.