Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 12 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
    
Silly question: why do you specify two seemingly mutually exclusive options at the same time? confdef vs confold? If this really works that's surely just a matter of the evaluation order? Not that I tried it ... – tink May 25 at 19:56

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.