1

I have recently been tasked with making a dev version of one of my production servers (both 12.04LTS). If I could create an image on my cloud service, it would be simple. Problem, these are both hosted on 2 different cloud service (firehost and azure).

I did not create the production server in question, but I need to make sure I at least have all of the same packages installed. I have tried:

dpkg --get-selections 

and did a diff between the dpkg's for both servers, but since this list include all dependencies installed, which is quite a large list and would take a while to sort through.

2 questions I guess:

1.) Am I going about this the proper way?

If yes,

2.) Can I get a list of just the top level packages installed?

No Time
  • 1,073
  • 11
  • 25
  • You could probably send the command through into a file, and use grep for what you are looking for. I am unsure exactly what packages you wish to look at, but I will add an answer if I can. – No Time Jul 16 '14 at 20:29
  • Are you cloning one server or 2 ? I do not understand the diff – Panther Jul 17 '14 at 18:27

1 Answers1

1

If you wish to do a comparison between the two, and have a movable list you could do:

dpkg --get-selections>new.txt

This will take your output and send it to a text file ('new.txt'). From there you can use grep to search through. For example:

grep '^linux*' new.txt

Or if you just need the packages quick combine the two

dpkg --get-selections|grep '^linux*'> new.txt

The single quote holds what you are looking for the carat (^) makes the search start with 'linux' the asterisk (*) is a wildcard (anything after linux is shown).

So linuxhappy.txt will show, but happylinux.txt will not. If you need an exact package name use a $ instead of an asterisk.

I am unsure of what you mean by 'top-level' packages exactly. I assume you mean you want to just get a list of programs which you can install, and then have the dependencies be resolved using apt-get or aptitude or Synaptic.

In that case if you look at: How to list dependent packages (reverse dependencies)? You should be able to see all of the dependencies you have. If you really want to see EVERY dependency for every program apt-cache dump, but that is extremely long.

No Time
  • 1,073
  • 11
  • 25