Configuring Apt to update automatically

Jurjen Bokma

April 2010


  1. apt-get install -y cron-apt

  2. From /etc/cron-apt/action.d/3-download, remove the line that starts with autoclean. We do want to update the machine soon after updates are available, but we do not want to lose old versions of programs, as these old versions enable us to do a rollback.

  3. Create a file /etc/cron-apt/action.d/4-dist-upgrade that reads:

      dist-upgrade -y
    	  

  4. Update /etc/cron.d/cron-apt to reflect the frequency of updating you wish.

    #
    # Regular cron jobs for the cron-apt package
    #
    # Every night at 4 o'clock.
    # 0 4   * * *   root    test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt
    # Every hour.
    0 *     * * *   root    test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2
    # Every five minutes.
    # */5 * * * *   root    test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2