Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have one machine setup with the apps I need, and I'd like to install the same on a new Ubuntu box.

Is there a script that will list all the installed apps, so that I can diff between the boxes and so add the missing items?

Thanks in advance, Chris

share|improve this question

7 Answers 7

up vote 17 down vote accepted

Aswell as the dpkg tricks mentioned by pjz, you may also want to look at etckeeper (tutorial ) - an app that puts your /etc/* under version control, making it easier to find any changes you've done and replicate them to other servers.

Also, for a shorter list than that produced by pjz's method, you can use

$ deborphan -a --no-show-section > /tmp/mypackagelist

This will give you a list of packages that will install all the other packages you require as dependencies. Can be useful if you actually want to look through the list. (dpkg --get-selections will produce a loooong list). In addition the list is short enough that you could add newlines and comment out entries with '#'. Then when installing the extra packages you can do

$ grep -v '#' /tmp/mypackagelist | xargs apt-get install -y

This way, if there are some packages you only want to install on some machines, you don't have to delete them from the package list altogether.

share|improve this answer
    
etckeeper looks really interesting (+1). –  jkp Apr 30 '09 at 17:30
dpkg --get-selections >/tmp/mypackagelist

should do the trick. Then, after making sure that your /etc/apt/sources.list on the new machine has the same set of entries as on the old, copy mypackagelist over to the new machine and do:

cat mypackagelist | xargs apt-get -y install

and you should be good to go.

Note that the dpkg --get-selections line is also good info to put into your /etc/dir ocassionally - it means you don't have to bother to back up /bin/ and /usr/bin/ and such because you know what packages are on the system.

share|improve this answer
    
Yes, Jeff, but how about the modifications to the configuration files? how about the dpkg-reconfigure options? how about hostnames... users, shares, mounts... See my response about dd bellow –  elcuco Jul 18 '09 at 10:01
    
great answer. i like the pipe to apt-get . nice. –  djangofan Apr 14 '10 at 20:27

Ubuntu Forums has a good answer

  1. On the old machine: $ dpkg --get-selections > installed-software
    • This gets your list of installed apps
  2. On the new machine: $ dpkg --set-selections
    • This sets the new machine to install the packages not currently installed on the new machine.
    • It might be interesting to see if the new machine has some packages not installed on the old machine, so you could find the dpkg --get-selections> command on the new machine, and then use diff to compare the output files from both.
  3. Finally, on the new machine: $ dselect and the packages will be installed.

Some additional links from the forums discussion:

  1. Don't forget your gpg keys (from the same thread)
  2. How to install all the desired packages and uninstall all the undesired packages
share|improve this answer

If you're not a CLI fan (although you really should be), you can use the Synaptic package manager to save the image of the installed packages, and use that file (again through Synaptic) to load the new machine. Under the file/save markings option, there is a checkbox called "save full state".

share|improve this answer
    
I think this was the method Cory found –  jbdavid Jun 2 '09 at 18:22

Why aren't you just clonning the machine using dd?

share|improve this answer
1  
This. Just clone the machine and change the name, it's by far the fastest way of doing it. –  pjc50 Jul 17 '09 at 16:46

There is a tool called ReMasterSys that can do it for you. see http://geekconnection.org/remastersys/

I hope that will be of use.

share|improve this answer

Using FSArchiver to replicate the machines is perfectly acceptable. Otherwise, here are useful pairs of commands, the first half of which you can also add to your backup cron:

debconf-get-selections
debconf-set-selections

~

aptitude-create-state-bundle
aptitude-run-state-bundle --unpack

~

dpkg --get-selections
dpkg --clear-selections; dpkg --set-selections

Locations you should replicate are /etc and /var. The above commands manipulate a few files in /var directly, and some conffiles in /etc indirectly via debconf. You will get the same effect by just replicating those subtrees and running aptitude.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.