HOWTO: Backup all installed programs/packages
PROBLEM: Lets say you have set up your *buntu box. Now you want to backup all the installed deb files so that you can restore them quickly and efficiently.
UPDATE: Why would you want this?
When I was using windows I had a directory of EVERY Single program that I had downloaded. For one thing it would be easier to install everything as I would not have to go online and hunt for them. Further it would be useful where a computer does not have internet connection. In ubuntu "hunting" for programs is a rare occurrence thanks to the fantastic package managing system. However, I personally have about 20-30 programs that I have either compiled from source (using checkinstall, so that that a deb package is created and they are added to APT), or downloaded debs from obscure locations. Now each of these debs I will save in a directory so that in the future I do not have to go hunting for them. However, this command I have outlined backs up ALL packages, including the ones in the package manager. So, why would you want that?
Firstly, this is VERY useful if lets say you have setup a very basic installation with all updates, and all non-free video/audio/etc codecs. Further you have installed some basic useful software. Now lets say you want to install the SAME setup on your grandmothers computer, except she does not have internet connection, or at the time you go to set it up she does not have a net connection. Using this script you can have all your debs in one simple location, so you will not have to redownload everything.
Secondly, lets assume you work for a school, or a company, and you need to install the SAME ubuntu installation on 30 computers. Wouldn't it be easier to simply put all these debs in a central server and issue the dpkg -i *.deb command. This way you don't have to individually select the packages AND the packages don't have to download.
Thirdly, (and this is purely personal) I like to be able to have all my installed packages at hand. This command doesn't take much effort, and for me it only requires 1.4 gb of space, so for a bit of piece of mind I can easily have all my packages on hand.
There is no real reason to do this if you are already doing a full system backup (e.g. an image of your Ubuntu partition using partimage). This is just something I discovered and feel could be beneficial to other users.
These commands will do that for you.
Open a terminal and paste the following into it:
Code:
$ sudo apt-get install dpkg-repack fakeroot
$ mkdir ~/dpkg-repack; cd ~/dpkg-repack
$ fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`
(the last command will take some time)
Now if you scroll to your home folder, you should find a folder called "dpkg-repack" which should have all the deb files of all your installed packages.
RE-INSTALL
If you want to re-install the packages, navigate to the folder with the packages and input the following command in the terminal:
Thanks to https://answers.launchpad.net/aptonc...n/15592/+index (Rafael)
NB: I know AptonCD does this but what prompted me to use this method was that I had done the sudo apt-get clean command which had erased all the files in the /var/cache/apt directory, rendering AptonCD useless (as all it does is take the files from there and put it in the list). So I find this method is more efficient, and easier for me to control!
Re: HOWTO: Backup all installed programs/packages
This is pretty cool, This will save some time when restoring my computer if I have screwed up the file system.
If you don't mind I am going to link this in the forums of the Backup Program that I use, QuickStart. http://quickstart.phpbb.net/index.php
Question: Do you have to save this in your home folder or can you change the path to an external drive?
Re: HOWTO: Backup all installed programs/packages
you should be able to do it anywhere you like. Haven't tested that though.
Just change: mkdir ~/dpkg-repack; cd ~/dpkg-repack
to wherever your external directory is (e.g. mkdir /media/external/dpkg-repack; cd /media/external/dpkg-repack)
I don't really want to create a username but would it be ok if I were to suggest requests for QuickStart? It seems like a great program!
Re: HOWTO: Backup all installed programs/packages
How do I restore these back-ups (from say, /media/Storage/dpkg-repack) after I've reinstalled?
Re: HOWTO: Backup all installed programs/packages
Re: HOWTO: Backup all installed programs/packages
Quote:
Originally Posted by abhiroopb
Code:
$ sudo apt-get install dpkg-repack fakeroot
$ mkdir ~/dpkg-repack; cd ~/dpkg-repack
$ fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`
Quote:
Originally Posted by
Het Irv
Hey Irv,
This is 'pretty cool' as you say.
Thanks for posting the link to here in the QuickStart forum. I'm always interested in back-up methods.
Do I understand this correctly in that this will create the .deb files again from the apps that are installed? Even if they were deleted using apt-get clean?
If this is something you want Irv, I don't see why we can't do it. If 'abhiroopb' would like to come over to our forum, we could talk with him some more and get his input for the addition.
Drop me a note in the QS forum Irv and let me know.
Thanks... mdpalow
Re: HOWTO: Backup all installed programs/packages
Yes this basically scans ALL installed deb packages (including those NOT installed through synaptic/apt) and downloads them to a local folder. Also I really liked the QuickStart script, although there are numerous additions/changes I would like to suggest. This is a bad time for me to work on anything though, if you would be willing to wait a couple of weeks I'd be glad to add my input.
Re: HOWTO: Backup all installed programs/packages
This will only backup programs not personal data, right?
Re: HOWTO: Backup all installed programs/packages
Quote:
Originally Posted by
Promaster91
This will only backup programs not personal data, right?
A debian file is much like an exe file in windows or a dmg file in OSX. So it is basically an installer. What this does is looks through ALL the installed programs in you're computer and downloads them to a local directory.
So to answer your question it does not touch any data of any kind. It simply downloads your installed programs.
Re: HOWTO: Backup all installed programs/packages
What is all this?:
Code:
dpkg-deb: ignoring 1 warnings about the control file(s)
warning, './dpkg-repack-20691/DEBIAN/control' contains user-defined field 'Original-Maintainer'
It's doing it's thing now.
Have a good day.
Bruce
EDIT: Once it's done can I just copy the directory to a DVD?