Saturday, January 31, 2009

Getting the public key of a ubuntu repository

I sometimes have problems when I add an APT line to the source.list and when I do and apt-get update, get an error message saying I do not have an authentication key, especially from one of the launchpad.net repositories. The usual message would be:

GPG error: http://ppa.launchpad.net intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0123456789ABCDEF

I have a short script that can help you get the correct key. Simply create a file called import-ubuntu-key.sh and type in the following code:

gpg --keyserver keyserver.ubuntu.com --recv $1
gpg --export --armor $1 | sudo apt-key add -

You then have to make the file an executable file, this can be done by using the chmod command with the +x switch:

chmod +x import-ubuntu-key.sh

To import the signature, simply type:

./import-ubuntu-key.sh 0123456789ABCDEF

The above assumes the script is located in the current directory and the repository's public key is located on the keyserver.ubuntu.com server.

No comments:

Post a Comment