set DEBIAN_FRONTEND=noninteractive  before running any apt-get command.