Monday, 25 March 2013

Keeping your Raspberry Pi updated with APT

Many Linux distributions including Raspbian for the Raspberry Pi come with the APT (Advanced Package Tool) package manager.

Access to this is often available as a GUI (Graphical User Interface), to help you update, upgrade and install new software packages on your computer. However if you can use APT via the command line you can save yourself a lot of time.

As a reminder to gain access to the command line, if you are logged directly into  the Raspberry Pi, you will need to load Terminal (click LXTerminal on the desktop). Alternatively Remotely logging into the Raspberry Pi via SSH gives you access to the command line.


The first thing is to ensure you are using the latest versions of software. There are two stages to this. First you want to update the list of available software which is stored locally on your machine. You should always do this before starting any type of upgrade. To do this simply type:

sudo apt-get update

To then upgrade any software packages type:

sudo apt-get upgrade

and enter y when asked "Do you want to continue [Y/n]?"


To search for a package that you would like to install type:

sudo apt-cache search packagename

i.e. for chromium


To then install this package:

sudo apt-get install packagename

i.e. for chromium

Before running this command it is often worth running with the flag -s, which simulates the install. This enables you to check that the install is only installing what you expected:

sudo apt-get install -s packagename

i.e. for chromium

Remember to run the command without the -s flag to actually install the package once you have simulated it.


To remove a software package use:

sudo apt-get remove packagename

i.e. for chromium

Again its worth running this with the simulation flag -s first to check everything is as expected:

sudo apt-get remove -s packagename

i.e. for chromium

Kernel Update

Every so often the kernel or core program needs to be updated. This is not updated using the apt-get upgrade command, so you need to specifically tell it to update the kernel. This is done by typing:

sudo apt-get dist-upgrade

Hopefully this has given you a brief  introduction into the APT package manager and how to keep all your software packages up to date using the command line.