Wednesday, 2 January 2013

Adding PPAs from behind a firewall

An Ubuntu user wishes to try out some nifty software from outside the main Ubuntu repositories, however they are annoyingly limited to only port 80 outgoing, so apt-add-repository won't work properly, it times out while waiting for a signed key from Ubuntu's servers. There is a solution.

First, add the PPA's repo manually, this can be done by expanding the "Technical Details about this PPA" part. Stick those lines in your /etc/apt/sources.list



Now, do a sudo apt-get update, and it will do its thing, but barf on verifying the signature, because it can't contact the keyserver.

$ sudo apt-get update
Ign http://gg.archive.ubuntu.com quantal InRelease

........
W: GPG error: http://ppa.launchpad.net quantal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A777609328949509
Now for the good bit. Make sure http_proxy is set, and use apt-key to import the key (use the key identifier from the error output earlier):

$ export http_proxy=http://<your proxy address:port>
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A777609328949509
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.rGta6LkQ9i --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys A777609328949509
gpg: requesting key 28949509 from hkp server keyserver.ubuntu.com
gpg: key 28949509: public key "Launchpad Gwendal Le Bihan" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
And there you have it. The PPA should now work.