Hardware and software failures are part of life. And that is why you need to have a backup plan. I have already written about backing up files and MySQL databases. There is no need to backup all installed binaries and software programs. The following tip will not just save your time, but both Debian and RHEL based distro can be updated instantly.
In order to reinstall or restore your installed software you need to have a list of all installed software.
HowTo: Create a Backup List of All Installed Softwares Under Debian / Ubuntu Linux
If you are using Debian or Ubuntu Linux, use the dpkg command to list installed software:
$ dpkg --get-selections
You can store list of installed software to a file called /backup/installed-software.log, enter:
$ dpkg --get-selections > /backup/installed-software.log
RPM based distributions (RHEL, Fedora, Redhat, CentOS, Suse Linux) user try the rpm command to get list of all installed software, enter:
$ rpm -qa
$ rpm -qa > /backup/installed-software.log
How Do I Restore Installed Software From a Backup List?
Under Debian/Ubuntu Linux type the following two commands to reinstall all the programs:
# dpkg --set-selections < /backup/installed-software.log
Once list is imported, use the dselect commmand or other tools to install the packages, enter:
Select 'i' for install the software.
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 the all software programs:
# LIST="$( cat /backup/installed-software.log )"
If you are using the yum comamnd, type the following for loop to install all software:
# for s in $LIST; do yum -y install $s; done
Update try out following command (thanks to gt):
# yum -y install $(cat /backup/installed-software.log)
A Note About RHEL version 4
If you are using RHEL 4 or older, enter:
# for s in $LIST; do up2date -i $s; done
Alternatively, you cah use the following command:
# up2date -i $(cat /backup/installed-software.log)
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop