Você está na página 1de 10

Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

Want to read Linu x tips and tricks, bu t don't have time to check ou r blog
everyday? Su bscribe to ou r email newsletter to make su re you don't miss a
single tip/tricks.

you@address.com

Home
T u torials
Shell/Scripts
Software
Howtos & FAQs
Foru m
Linu x docu mentation
RSS

About nixCraft

Daily Linu x tips, hacks, news, ideas and mu ch more »

nixCraft welcomes readers' articles and gu est blogging posts. We're


interested in articles on programming, secu rity, database, Linu x and
anything else related to technology .

Topics

Backu p
Linu x
Shell scripting
T ips
See all topics...

Linux Get list of installed software

1 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

for reinstallation / restore software


Posted by Vivek Gite [Last u pdated: March 9, 2008]

My first server?
Uw eers te s erver wordt uw mees t prettige Hardware and Software
ervaring. Verbaas d? Z ie: failu res are part of Life.
www.ea sybow.nl/iNode/
T hat is why you need to
Linux So ftware have a backu p. I have
Get the lates t news , white papers , already written abou t
dis cus s ion threads , and much more. backing files and MySQL
Linux.I Ttoolbox.com
databases. You need not to backu p all
Linux installed binaries (mostly software) with
Bes paar geld. Implementeer ipv Windows following tips. It will not ju st save you r
s oftware, Linux s oftware. time bu t both Debian and RHEL distro
www.kra tz .nl/
can u pdate them instantly.

In order to reinstall or restore you r


installed software you need to have a list of all installed software.

Task: Backup list of installed software

Debian Linux
If you are u sing Debian Linu x u se dpkg command to list installed software:
$ dpkg --get-selections

Store list of installed software to a file called /backu p/installed-software.log


$ dpkg --get-selections > /backup/installed-software.log

RPM bas ed dis tributions (RHEL, Fedora Core, Cent OS, Sus e Linux
etc)
Use rpm command to get list of all installed software:
$ rpm -qa
OR
$ 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 Linu x makes you r life easy. All you have to do is type following two

2 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

commands:
# dpkg --set-selections < /backup/installed-software.log
Now you r list is imported u se dselect or other tools to install the package.
# dselect

Select 'i' for install the software.

RPM bas ed dis tro


As far as I know RPM based distro does not offers dpkg kind of facility. Bu t
with little shell scripting technqu ie you can easily install all software:
# LIST="$( cat /backup/installed-software.log )"

If you are u sing yu m, type the following for loop to install all software:
# for s in $LIST; do yum install $s; done
Update try ou t following command (thanks to gt):
# yum -y install $(cat /backup/installed-software.log)

OR if you are u sing RHEL (RHN su bscriber) :


# for s in $LIST; do up2date -i $s; done

Alternatively you u se following command:


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

Want to stay u p to date with the latest Linu x tips, news and
annou ncements? Su bscribe to ou r free e-mail news letter or RSS feed to
get all u pdates. You can Email this page to a friend.

www.EventLogAna lyz er.com Feedba ck - Ads by Google

You may also be interested in other helpful articles:

T op 10 Hits and Zeitgeist of 2006 for you r edification and fu n

3 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

Best Linu x / UNIX Posts of 2007: Part ~ II


Howto u pgrade Debian 3.1 Sarge to Debian 4.0 Etch stable
Download of the day: Su per Gru b Disk to fix Windows and Linu x boot
problems
Fix a du al boot Windows Vista and Linu x problem

Discussion on This Article:

1. gt Says: August 24th, 2006 at 7:15 am

better ru n yu m only once:

rpm -qa > /backup/installed-software.log


for i in $(cat /backup/installed-software.log) ; do packages+="$i " ; done
yum install $packages

2. nixcraft Says: August 24th, 2006 at 7:56 am

Mu ch better

Appreciate you r post/script

3. textshell Says: August 24th, 2006 at 1:40 pm

xargs yu m install

4. nu clearjoker Says: August 24th, 2006 at 2:01 pm

And if you u se Gentoo Linu x it wou ld be as follows:

# cat /var/lib/portage/world
to get the list of packages

#emerge -av $(cat /path/to/backu pworldfile.txt)

5. gsiems Says: August 24th, 2006 at 3:02 pm

rpm -qa > /backup/installed-software.log

yu m install `cat /backu p/installed-software.log | tr "\n" " "`

6. gt Says: August 24th, 2006 at 5:40 pm

or barely:

4 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

yu m install $(cat /backu p/installed-software.log)


so simple!

7. nixcraft Says: August 24th, 2006 at 6:27 pm

Dam … I shou ld have u sed this one liner

8. patrick Says: August 24th, 2006 at 6:31 pm

nu clearjoker, not to troll ou t of u

Bu t whole point of this article is abou t binary software install/u pdate,


IMPO. What you pointing is sou rce compile u nder gentoo linu x

Please correct me if I am wrong.

9. Aru n Says: August 24th, 2006 at 6:38 pm

Good article. T hanks.

10. Jarl Says: August 24th, 2006 at 6:41 pm

For me this approach is the same that install from DVD/CDROM with
the regu lar installer. Where are the own files? configu ration files,
cu stomizated setu ps, and so on.

11. nixcraft Says: August 24th, 2006 at 6:48 pm

Jarl,
As I said earlier, I am assu ming that you are having a backu p of /etc
config file and other important data to tape or FT P or NAS server.
Please read following u rl. T his article is actu ally follow-u p to earlier
article.
Once application installed you can simply restore both data and
configu ration file.

Also, consider the CD/DVD media is not u p-to-date or does not carries
patched version. T his method offers ou t of box protection as both
u p2date, yu m or apt-get installs patched/u p-to-date version.

HT H

12. Daniel M. Webb Says: August 24th, 2006 at 6:59 pm

You can also u se “apt-get dselect-u pgrade” instead of dselect.

13. T Q Says: August 24th, 2006 at 7:16 pm

5 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

Instead of dselect, can aptitu de be u sed instead? What are the


parameters involved?

T hanks.

14. nixcraft Says: August 24th, 2006 at 7:45 pm

Short answer YES

Long answer - Both dselect and aptitu de act as a Debian package


management frontend.

15. Matthew Hall Says: August 24th, 2006 at 10:06 pm

Even easier - Fedora u sers shou ld get their installed packages list
au tomagically u pdated every day to ‘/var/log/rpmpkgs’ - so, assu ming
you ’ve taken a backu p and restored the file the following shou ld
su ffice:

yu m -y install $(cat /var/log/rpmpkgs)

16. zerohalo Says: August 25th, 2006 at 2:51 am

How wou ld you do this on Ubu ntu u sing apt-get instead of dpkg?

17. nixcraft Says: August 25th, 2006 at 4:47 am

apt-get command does not su pport this kind of facility. You need to
u se dpkg command only.

18. Grant Says: August 25th, 2006 at 7:24 am

When you install with CentOS it pu ts the list of installed rpms in


/root/install.log. If root’s home dir is backed u p you ’re in bu siness.
Althou gh I dou bt if it’s u pdate after the install.

Cou ldn’t you ju st create a kickstart disk after install/config and pop it
in to reinstall then do a yu m u pdate? T hat wou ld get you closer than
ju st reainstalling packages. Of cou rse all of this is fu n to talk abou t
bu t realistically you ’d have backu ps and you ’d ju st restore… I backu p
MBRs and files. T hrow a live cd in the machine to be restored and from
the backu p server - dd if=/backu p/MBR.bin | ssh “cat | dd of=/dev/hda”

It’s late and this is from memory bu t I think that’ll work to restore the
MBR across the network. T hen format and restore from backu p.

19. chewie Says: August 25th, 2006 at 6:10 pm

6 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

For Debian systems, you can also grab the debconf database and u se it
to preseed the installation qu estions that occu r, inclu ding how to
partition you r hard drive. T his allows you to completely au tomate the
installation process. Check ou t the debian-installer Install manu al at
http://d-i.alioth.debian.org/manu al/en.i386/apb.html.

20. Motin Says: March 5th, 2007 at 2:55 am

T here is a hu ge disadvantage u sing package lists - it lists a lot


packages that one have not chosen to install bu t are installed becau se
they are dependencies. T his makes it veeery tediou s to restore if the
list is somewhat old or u sing another distro since dependencies change
a lot.

For debian-based system: Install “debfoster” and ru n it. After


answering a lot of qu estions abou t you r packages you will have a
system withou t u nnecessary packages and a short list of only the
packages that you have actively chosen to install.

21. cambo81 Says: June 24th, 2007 at 12:08 am

hi im new to this comp. stu ff bu t i ju st got 1 qu estion. i installed a


game as imess arou nd my laptop i u ninstalled the game that i ju st
installed. how can i recover that lost game cau se i do not have the disc
anymore please help me.

22. Caio Says: October 20th, 2007 at 6:50 pm

T hat’s why I LOVE LINUX!

23. peace Says: March 9th, 2008 at 11:57 am

nice tu t man I LOVE LINUX too mu ch

24. Don Says: March 11th, 2008 at 10:02 am

Ju st what I needed
Linu x is great!!!

25. ZaK Says: April 10th, 2008 at 10:42 pm

Im new to linex i was viewing u torrent in VNC i closed it by mistake


how do i ru n it again so i can view the cu rrent activities

26. Narendra Sisodiya Says: May 14th, 2008 at 12:39 pm

su ppose i have 3 software A B and C

7 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

now i have taken backu p..in log file..


now,, I have installed D and E , and removed B
– If Now i will restore then i will be having A B C D E , bu t is now a fu ll
restore,,,
ideally,, you need to create a new backu plist of software which has A C
D and E
and then find the diff so that you can get D and E are extra software to
remove first and B is need to installed. also,, you need to check that
software are available or not, bu t nice article ,,, can be integrated in
Yu mex

27. Diabolic Preacher Says: May 28th, 2008 at 6:55 am

for debian/u bu ntu method. will it reinstall all the 1313 packages that i
noted as being saved to the backu p log or will it skip the packages that
need not be u pdated?

Leave a Reply

We encou rage you r comments, and su ggestions. Bu t please stay on topic,


be polite, and avoid spam. T hank you very mu ch for stopping by ou r site!

Name (required)

Mail (will not be published) (required)

Website

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b>
<blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike>
<strong>

Anti-spam word: (Requ ired)*


T o prove you're a person (not a spam script), type the security word shown in the picture. Click

8 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

on the picture to hear an audio file of the word.

Submit Comment

Notify me of followu p comments via e-mai.

Tags : backu p linu x software, binaries, Debian Linu x, distribu tions, dselect ,
fedora core, for loop, mysql databases, restore linu x software, rhel, rpm,
Shell scripting, software failu res, software list , software task, su bscriber,
u p2date command, yu m, yu m command

Search

Search

Would you like to...

Print this page


Email this page

more ~/options

Abou t u s
T estimonials
Contact u s

Archives

Select Mont h

nixCraft RSS Feeds

Recent Comments
Hacking Beetel 220x ADSL rou ter (Broadcom BCM6338)

9 of 10 08/14/2008 03:35 PM
Linux G et list of installed software for reinstallatio... http://www.cyberciti.biz/tips/linux-get-list-installed...

T oday ~ 149 Comments


Linu x u ltra fast command line download accelerator
T oday ~ 29 Comments
Linu x: How to see du al Core AMD or Intel CPU statistics
T oday ~ 5 Comments
CentOS / Red Hat Linu x: Install and manage iSCSI Volu me
Yesterday ~ 5 Comments
Copy hard disk or partition image to another system u sing a network
and netcat (nc)
Yesterday ~ 13 Comments

Recent Articles
dnsmasq Dns Cache Software Secu rity Update T o Fix DNS Spoofing
Attacks
How T o Install Pu ppet System Management T ool T o Au tomate T asks
Across T he Network
Download Of T he Day: gOS A Lightweight Linu x Distribu tion (ISO
Images)
Comparison: Linu x Disk Schedu ler
Download of the day: Vim T ext Editor 7.2
Paid Su pport From Novell / Red Hat Not Important for Linu x Adoption

Don't Miss
How T o Find Ou t What My DNS Servers Address Is
MySQL Change root Password
Howto: Linu x Add User T o Grou p
Linu x and Open Sou rce Software Blog by Vivek | nixCraft
Open rar file or Extract rar files u nder Linu x or UNIX
Ubu ntu Linu x: How to Install Flash Player for firefox
See all...

Copyright © 2004-2008 nixCraft. All rights reserved - T OS/Disclaimer -


Privacy policy - Sitemap - Powered by Open sou rce software.

10 of 10 08/14/2008 03:35 PM

Você também pode gostar