Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list the minimal set of Debian packages needed to recreate a set of installed packages?

Is there a way of getting dpkg, apt-get or aptitude to produce a list of the packages which need to be installed on a second machine to duplicate the packages installed on a first?

i.e. If I've installed a plain Ubuntu server, chose the sshd option at install time, then installed build-essential I would expect the output to look something like:

#ubuntu 9.10 server
openssh-sshd
build-essential

As far as I can see, all the available packaging tools will produce a verbose list of the packages on a box. I'm not interested in openssh libs, ld, gcc, and all the other packages pulled in by sshd and build-essential, as they will be installed when I install sshd and build-essential.

I would like to see just the list of the package which I need to install to recreate my current set of packages on another machine.

Is this possible?

like image 507
fadedbee Avatar asked Feb 16 '10 15:02

fadedbee


People also ask

Which command may be used to get a list of the installed Debian packages?

dpkg-query is a command line that can be used to display information about packages listed in the dpkg database. The command will display a list of all installed packages including the packages versions, architecture, and a short description.

Which is the name of the list of software sources for Debian package management?

The Apt (Advanced Package Tool) package management system is a set of tools to download, install, remove, upgrade, configure and manage Debian packages, and therefore all software installed on a Debian system.


1 Answers

deborphan, sort of. It builds a list of every package in your system, figures out what depends on what, and prints out the packages that don't have any dependencies. By default it only prints libraries (to make it easy to find libraries that were installed by other packages and no longer needed, hence the name). It has options for doing what you want, mostly. I run it like:

deborphan -anp required --no-show-section

-a specifies all packages (not just libraries)
-n ignores "Suggests" or "Recommends" dependency checking (i.e. just "Depends")
-p required lists all packages despite priority
--no-show-section doesn't indicate which part of debian it's in, just a nice formatting feature you might find useful for building a list.

Now, it will miss packages, because some packages have circular dependencies. But those tend to be fairly uncommon, so it should get you close enough.

like image 78
Eric Warmenhoven Avatar answered Sep 18 '22 13:09

Eric Warmenhoven