Task: Backup list of installed software
If you are using Debian Linux use dpkg command to list installed software:
$ dpkg --get-selections
Store list of installed software to a file called /backup/installed-software.log
$ 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:
$ rpm -qa
$ 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 makes your life easy. All you have to do is type following two commands:
# dpkg --set-selections < /backup/installed-software.log
Now your list is imported use dselect or other tools to install the package.
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 technquie you can easily install all software:
# LIST="$( cat /backup/installed-software.log )"
If you are using yum, type the following for loop to install all software:
# for s in $LIST; do yum install $s; done
Update try out following command (thanks to gt):
# yum -y install $(cat /backup/installed-software.log)
OR if you are using RHEL (RHN subscriber) :
# for s in $LIST; do up2date -i $s; done
Alternatively you use following command:
# up2date -i $(cat /backup/installed-software.log)