Search

About this Entry

This page contains a single entry by goozbach published on January 7, 2008 6:54 PM.

my dream home was the previous entry in this blog.

Using Virt-clone is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

My Latest Tweet

    loading...

I am a genious (SIC)

| | Comments (0) | TrackBacks (0)
I have two Debian servers, One is the old one, running on hardware that dell is no longer supporting (without us shelling out again) in a couple months. The other -- the new one-- is a virtual instance I have just installed on top of Citrix XenServer. Both are running Debian 4.0 "Etch". 

The application we have running on the old server has quite a few dependencies, and the Operating system hasn't been re-installed in quite some time. As a matter of fact, it is running an image which was based off an image which was based off an image.  In other words, I needed a quick and dirty way of installing all the packages which are needed on the new server, without using the old image.

Here's what I did:

First, on both servers I made a list of the packages which were installed. I did this by running the command:
root@oldhost # dpkg -l > packages.old
and on the new server:
root@newserver # dpkg -l > packages.new
I then combined the lists using text tools such as 'cat' 'sort' 'uniq' etc...
Then I used vimdiff to find the differences between the two servers and make choices as to which packages I wanted installed.  All in all I ended up with a third list which was my cleaned list of packages.

After copying the clean list to the new server, I ran this command:
perl-01:/tmp# for i in `cat packages.final` ; do dpkg -l $i &>/dev/null && echo "found package: $i, doing nothing" || apt-get install $i; done

This command will install a package if it's not currently on the system, and output "found package $foo, doing nothing" if it is already installed. You have only to sit at the prompt and answer any of the dpkg-configure questions which may pop up.

Cool, no?

0 TrackBacks

Listed below are links to blogs that reference this entry: I am a genious (SIC) .

TrackBack URL for this entry: http://blog.friocorte.com/cgi-bin/mt/mt-tb.cgi/40

Leave a comment