Automate System Updates in Ubuntu

If you’re administering your server in Ubuntu, you might want to set up a cron to update and upgrade your software each night.  There’s an easy way to do this thanks to the convenient Ubuntu package cron-apt.

To automate daily bug and security updates to your Linux system, first install cron-apt with the following command:

apt-get install cron-apt

Then configure it to email you the results each time it runs, edit /etc/cron-apt/config to include the following lines:

MAILTO="you@emailaddress.com"
MAILON="always"

Lastly, link it to cron.daily by running the following command:

sudo ln -s /usr/sbin/cron-apt /etc/cron.daily/

This should keep your system nicely up-to-date.  If you’re feeling a little wild (and you’ve backed up everything), you might also want to upgrade to the latest version of Ubuntu every once in a while (but this should never be automated).

HOW TO find php.ini in Ubuntu

Looking for the primary php.ini in Ubuntu to change some default settings across Apache?  No problemo.  Here are three different options for finding it:

  • Try running this <?php phpinfo(); ?> through your PHP interpreter.  This will show you where your main php.ini file is.
  • Or you can try searching for it in the shell:  find / -name php.ini
  • If all else fails, give it the old college try, and see if my setting works for you:  /etc/php5/apache2/php.ini (I’m on Ubuntu 9.10 – karmic).

This should just about do it for you, old chap.