After installing a ubuntu 12.04 (precise) server on a host behind a firewall. I tried to update the apt repositories to install some software. And received the following error message:
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
So I tried to fetch the missing key with:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192
Which did not work because the firewall was blocking port 11371 which is needed to fetch the apt keys. What a pain there must be a way to fetch the keys via another port. Maybe port 80 which should be open in most cases. Then I came across this command which did the magic:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 16126D3A3E5C1192
This command fetches the missing keys via port 80 which worked for me. If you need more than one key just add them to the –recv-keys line seperated by a space. Thats it.