Ubuntu – Backup all installed softwares

backupsoftware installation

I was thinking to backup installed software on my Ubuntu 14.04. So that when system gets corrupt, I can just copy-paste those folder and get all installed programs back along with their entries in dash.

For this I wanted to know which all possible folder are affect when we install a program ?

At my home internet is not fast speed so reinstalling those software from internet takes many hours

Best Answer

Many many folders are affected when installing software. For a complete picture see How to understand the Ubuntu file system layout? Directories you will need are /bin/, /sbin/, /usr/, /etc/, /var/ , /lib/, /home/, /opt/ (3rd party software goes to /opt/; might be empty). /boot/ might be needed too depending on what you install.

I would reconsider if I was you. Your approach is pretty Windows oriented. The directories you need are almost all of them. And there are better methods.


Backup of your installed software after installing Ubuntu

There is a method you might like: /var/cache/apt/archives/ holds all the installer files you need if you want to restore your system. If you back that up and re-install Ubuntu you can copy them back to /var/cache/apt/archive and can use the dpkg command to restore them. That would require you to backup that directory and your /home/ (all settings are there). This might be a good option to restore a system with a re-install and after installing a manual update of those packages and a restore of your /home/.


Full system backup

If you want to do this a full system backup is the best option. It would stop you from picking directories and the directories you do not nee is marginal at best. You can even automatic this with an rsync backup where the system only copies what got changed. Saves a lot of disk space. Have a look at ...

A full system backup is a good method in case your hardware is going to act up. Think bad sectors, crashes due to hardware failure. Upgrading to a new release that might fail. Or to copy your system over to a new harddisk, or new system. We are talking about some of the bigger problems computers can have or software can cause.

It also guarantees you backup everything. So if there is some obscure directory we know nothing about that you would have liked to see a backup of this makes sure it will be there on the backup.


Single file backup

In case of you wanting to save yourself from yourself a full system backup is overkill. If the main concern is editing files that might go wrong and you effectively kill your system yourself the best approach is to create a backup of the file you want to edit. Let's assume you want to manually edit a file called "test". A simple...

cp file.txt file_$(date +%Y%m%d_%H%M%S).txt

will create a file with the date with seconds include.

cp test.txt test_$(date +%Y%m%d_%H%M%S).txt
~/Downloads$ ls test*
test_20141207_171058.txt
test.txt

This will be more than enough to keep your system from breaking down by your own hands. Normally you can still boot and restore your file but if needed you can also use a live dvd to just copy the file back over the original file with...

cp test_20141207_171058.txt test.txt

are restore your system to a working one.

If you keep forgetting to make backups: Gedit is capable of making automated backups (it adds "~" at the end of the file before you save the changed one).

Related Question