2009-11-15

So you want to install a bunch of packages after install

Ok the usual way to get a system ready for install is to use kickstart to do so. I am going to set up cobbler to do this later, but since I had a broken disk and only a F12beta DVD I went the 'hard' route of installing by hand and doing most of the extra configuration afterwords.

One of the things I was able to do before the laptop's hard-drive completely failed was to get an rpm listing:

export LANG=C
rpm -qa --qf='%{NAME}\n' | sort -u > RPM-QA.doomed

Then during the install I just picked some defaults and got a 'finished' system up with a minimal of hassle. Once the box was up and on the network I made a new listing.

export LANG=C
rpm -qa --qf='%{NAME}\n' | sort -u > RPM-QA.new
comm -2 -3 RPM-QA.doomed RPM-QA.new | awk '{print "install "$0} END{print "run"}' > big-list

I then went through the file big-list to remove some things that I didn't want this time.. and then used yum-shell to install these in a large batch.

yum shell big-list

watch lots of things, type y when it says to do so... and wait for 2 GB of RPMs to be downloaded over 768kbit line. Coming in the next morning, I had a system that pretty much matched the old laptop except for some packages no longer in F12 (DeviceKit, etc). This gives me a 'new' list to work against when F12 final comes out and I want to reinstall again.

ToDo: this wasn't the best way of doing this, but it works. Thanks to the yum developers for making it work so well from the command line mode. I look forward to figuring out ways I could do this better in the future.

3 comments:

none said...

great suggestion!

Unknown said...

Why LANG=C? I thought maybe for speed, but I tried a couple tests and didn't see any difference.

Also I think you could skip the awk and shell and just do "yum -y install $(cat list)" but maybe you wanted the interactive part.

Stephen Smoogen said...

The LANG=C only matters in getting the C the same sort as before. While it hasn't happened in a while a long time ago I had files that were sorted under one release being different from another because en_US did it different from en_US.utf8 or something. LANG=C is 'guarenteed' to sort in one way so that you don't end up with comm complaining:

Files not in sorted order.

To answer the second question.. the cat list can run into the bash string limit (I think its 4096 characters per input) that means if you have a lot of files you may not get everything you wanted. Putting it to a file and importing that file gets around that.