Automatically keep current version of config files when apt-get install

Solution 1:

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";
}

Solution 2:

On current ubuntu systems you need a bit more:

export DEBIAN_FRONTEND=noninteractive ; apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes

Tags:

Ubuntu

Debian

Apt