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 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 file such option. Will the mighty Serverfault community help me ?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer

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
share|improve this answer

Your Answer


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.