/Raspberry Pi, Raspbian, update

Update Raspbian on Raspberry Pi

It's highly recommended to update your Raspbian as often as possible to make sure you always have the latest security patches and updates.

Manual update

Open Pi's console and update package list by running the following command:

sudo apt-get update

Then upgrade your packages to their latest versions with below command:

sudo apt-get dist-upgrade

This should keep you up to date and away from trouble.

Automatic updates

If you don't like to this this manually, or simply forget about it, I suggest you set up an automatic update and never have to think about it again.
There's a number of ways you can do that. There are programs that take care of that for you and have lots of options and configurations. I'll focus here on the easiest and most basic option, which is a simple cron job.
Switch to root and open crontab:

sudo su
crontab -e

If this is the first time you run crontab as root, you'll be asked to choose your preffered editor.

[email protected]:/home/pi# crontab -e
no crontab for root - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/mcedit
  4. /usr/bin/vim.tiny

Choose 1-4 [2]:

Once you choose your editor, enter below line at the bottom of your crontab:

0 4 * * 1 apt-get update && apt-get -y dist-upgrade

Above will run update every Monday at 4am. If you prefer a different time but don't know how cron settings work, here's a very helpful site.