Networking HowTos
Networking HowTos

Updating Ubuntu with the APT package manager

January 25, 2012 Linux, Ubuntu

Updating the software running on a operating system is an important part of maintaining a computer. Not only does it allow you to keep up to date with the latest features in the applications you use, it is also crucial to keep your system as secure as possible.
The APT (Advanced Package Tool) package management system makes installing/updating/removing packages extremely simple.
The first step in the process is to update the APT sources. This downloads the latest package lists, so the APT system knows what software is available, and also what software has an update available.
To update the sources, run the following command:

$ sudo apt-get update

Example output:

$ sudo apt-get update
Hit http://au.archive.ubuntu.com lucid Release.gpg
Hit http://au.archive.ubuntu.com/ubuntu/ lucid/main Translation-en_AU
Hit http://au.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-en_AU
Hit http://security.ubuntu.com lucid-security/universe Packages
...
... (Lines cut out to save space)
...
Hit http://security.ubuntu.com lucid-security/universe Sources
Hit http://security.ubuntu.com lucid-security/multiverse Packages
Hit http://security.ubuntu.com lucid-security/multiverse Sources
Reading package lists... Done

Once you have the latest package sources, you can proceed to running the command to actually update all packages that have an update available.
Run the following command to update all packages:

$ sudo apt-get -y upgrade

Note: The -y option automatically chooses “yes” when you would normally be asked to confirm if you want to install the updates.
Example output:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-headers-server linux-image-server linux-server
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Note: No applications actually got upgraded in this example.
To run a update and upgrade in a single command, use the following:

$ sudo apt-get update && sudo apt-get -y upgrade

To update the actual distribution, you need to run the following command:

$ sudo apt-get dist-upgrade

Make sure you have already updated the package source list using the “sudo apt-get update” command.
If you are running as root, you don’t need the “sudo” statement in any of the above commands.
For more details on apt, check the following sites:
http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
https://help.ubuntu.com/community/AptGet/Howto

You Might Also Like