Apt-Get Install – Automatically Keep Current Version of Config Files

aptdebianUbuntu

I need to automatically install a package with its config file already present on the server.

I'm looking for something like:

apt-get install --yes --force-yes --keep-current-confs mysql-server

Probably a dumb question but I can't find such an option.

Best Answer

Found the answer on Raphael Hertzog's Blog :

apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y mysql-server

It's dpkg's role to configure, therefore to chose which conf file to keep.

You can also add this to the config of the system by creating a file in /etc/apt/apt.conf.d/ with this content:

Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}