Installing deb repository requires gpg-keys some time. Recently, I am trying to add a mongo repository for Ubuntu 14, which requires to request some gpg keys first. If you use

# gpg --keyserver keyserver.ubuntu.com:80 --recv-keys SOMEKEYS # doesn't work
gpg: requesting key SOMEKEYS from keyserver.ubuntu.com:80
gpgkeys: no keyserver host provided
gpg: keyserver internal error
gpg: keyserver receive failed: keyserver error

or

# gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEYS # keep in stuck
gpg: requesting key SOMEKEYS from hkp server keyserver.ubuntu.com
^C
gpg: Interrupt caught ... exiting

It would never be work.

A correct way is:

# apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys SOMEKEYS
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.kjy6QolfzJ --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/openjdk-r-ppa.gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key SOMEKEYS from hkp server keyserver.ubuntu.com
gpg: key SOMEKEYS: public key "Some Description" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

or

# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys SOMEKEYS
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.kjy6QolfzJ --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/openjdk-r-ppa.gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key SOMEKEYS from hkp server keyserver.ubuntu.com
gpg: key SOMEKEYS: public key "Some Description" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
来自的你,很高兴你能看到这儿。若本文对你有所用处,或者内容有什么不足之处,敬请毫不犹豫给个回复。谢谢!