Good Ingredients

Update and Upgrade

Recipes > Core Recipes > .. > Update and Upgrade

The first thing you need to do once you've logged in as root to a newly installed Debian system with SSH is to update the list of packages available and upgrade new packages to the latest versions. Of course, as you know, you should never normally log in as root and when you configure SSH in the Basic SSH Security article you'll disable root login over SSH.

First check that the list in /etc/apt/sources.list is as you expect. If you've installed Debian from an OpenVZ template for example it might need updating to reflect a mirror nearby. Here's how it should look for a computer in the UK:

deb lenny main
deb-src lenny main

deb lenny/updates main
deb-src lenny/updates main

deb lenny/volatile main
deb-src lenny/volatile main

Now update and upgrade your system as the root user like this:

# apt-get update
# apt-get upgrade

The # character above represents the root user's prompt, you do not need to type it.


If you get this warning:

W: GPG error: lenny Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B
W: There is no public key available for the following key IDs:
W: You may want to run apt-get update to correct these problems

You should run this:

gpg --keyserver --recv-keys 9AA38DCD55BE302B
apt-key add ~/.gnupg/pubring.gpg

Then run the commands again:

apt-get update
apt-get upgrade

You will now have a fully up-to-date system. If you have only just installed Debian, you should already have the latest packages so don't be suprised if there is nothing to update.

(view source)