2

Running Debian Lenny distros :

I'm still wondering how to iso a complete distro setup "easily", but for the time being, I'd like to able to run easily and quickly a reinstall, so I added such a line in my rsync backup shells :

# Store the list of installed packages
dpkg --get-selections > $PACKAGES

Is there a better way using dpkg or another tool in order to be able to generate an automated reinstallation file from an existing system in case of failure ?

hornetbzz
  • 170
  • 9

2 Answers2

3

apt now tracks which packages are manually installed vs. those which are automatically installed. A manually installed package is one where you explicitly requested it to be installed. When you run apt-get install foo, then foo is marked as "manually installed". When, in order to satisfy the dependencies of foo, it also has to install bar, then bar is marked as "automatically installed". This is useful so that later, when you apt-get remove foo, the system can know that you no longer need bar either.

Your method, using dpkg --get-selections will lose this information. A better package list can be obtained by getting a list of just the manually installed packges:

aptitude search '~i!~M' -F %p

~i means "installed packages". !~M means "not automatically installed". -F %p formats the output to be package names only.

When you install packages, they often prompt you for more configuration options. This is stored in the 'debconf' database. You may want to also backup this database. This database can be backedup and restored with debconf-get-selections and debconf-set-selections which will require the debconf-utils package.

stew
  • 9,263
  • 1
  • 28
  • 43
2

That looks like the easy way to me.

The more complicated and involved way is to define everything using a tool like Puppet or Chef. To that extent, I try to think of my files in one of three categories:

  • Software
    • Anything owned by an installation package
    • If I'm custom-installing something in production, it should be through a custom package
  • Configurations
    • These might overwrite package-defined configurations.
  • Data

Configurations are managed and backed up through Puppet. Software packages come from online mirrors and installation media. Data is "everything else" and ideally limited in the directories that it can show up in. That makes backups simpler, smaller, and faster and allows for easy migration to other machines or reinstallation of a system for any reason.

Jeff Ferland
  • 20,239
  • 2
  • 61
  • 85
  • thx, I could install puppet from my src list, but just one question: did you install and use this on a production machine ? (as I'm reluctant to install many stuffs for admin tasks on a prod machine) – hornetbzz May 17 '12 at 00:52
  • Yes, I use this to manage production systems. – Jeff Ferland May 17 '12 at 02:40