How to Get list of installed software and restore in Linux?

Linux OS Topics
Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

How to Get list of installed software and restore in Linux?

Post by Saman » Thu May 20, 2010 3:14 am

Hardware and Software failures are part of Life. That is why you need to have a backup. I have already written about backing files and MySQL databases. You need not to backup all installed binaries (mostly software) with following tips. It will not just save your time but both Debian and RHEL distro can update them instantly.

In order to reinstall or restore your installed software you need to have a list of all installed software.

Task: Backup list of installed software

Debian Linux
If you are using Debian Linux use dpkg command to list installed software:

Code: Select all

$ dpkg --get-selections
Store list of installed software to a file called /backup/installed-software.log

Code: Select all

$ dpkg --get-selections > /backup/installed-software.log
RPM based distributions (RHEL, Fedora Core, Cent OS, Suse Linux etc)
Use rpm command to get list of all installed software:

Code: Select all

$ rpm -qa 
OR

Code: Select all

$ rpm -qa > /backup/installed-software.log
Task: Restore installed software from backup list
Now you have a list of installed software. After installing base system you can immediately install all software.

Debian Linux
Debian Linux makes your life easy. All you have to do is type following two commands:

Code: Select all

# dpkg --set-selections < /backup/installed-software.log
Now your list is imported use dselect or other tools to install the package.

Code: Select all

# dselect
Select 'i' for install the software.

RPM based distro
As far as I know RPM based distro does not offers dpkg kind of facility. But with little shell scripting technique you can easily install all software:

Code: Select all

# LIST="$( cat /backup/installed-software.log )"
If you are using yum, type the following for loop to install all software:

Code: Select all

# for s in $LIST; do yum install $s; done 
Update try out following command (thanks to gt):

Code: Select all

# yum -y install $(cat /backup/installed-software.log) 
OR if you are using RHEL (RHN subscriber) :

Code: Select all

# for s in $LIST; do up2date -i $s; done 
Alternatively you use following command:

Code: Select all

# up2date -i $(cat /backup/installed-software.log)
Post Reply

Return to “Linux”