{"id":455,"date":"2016-02-02T21:27:38","date_gmt":"2016-02-02T13:27:38","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=455"},"modified":"2018-09-05T23:24:57","modified_gmt":"2018-09-05T15:24:57","slug":"how-to-manually-add-a-public-pgp-key-to-ubuntus-advanced-packaging-tool-apt","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-to-manually-add-a-public-pgp-key-to-ubuntus-advanced-packaging-tool-apt\/","title":{"rendered":"How to manually add a public PGP key to Ubuntu&#8217;s Advanced Packaging Tool (APT)"},"content":{"rendered":"<p>I was trying to install docker on my Ubuntu server as an initial step to set up a continuous integration server for my Python project. As I was following through <a target=\"_blank\" title=\"Docker reference to install docker engine on Ubuntu\" href=\"https:\/\/docs.docker.com\/engine\/installation\/ubuntulinux\/\">the guide provided by docker<\/a>, the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-key adv --keyserver hkp:\/\/p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D\r\n<\/pre>\n<p>gave me the following error:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngpg: requesting key 2C52609D from hkp server p80.pool.sks-keyservers.net\r\ngpg: keyserver timed out\r\ngpg: keyserver receive failed: keyserver error\r\n<\/pre>\n<p>I did a ping afterwards and affirmed that my server was not able to reach the key server at <code>p80.pool.sks-keyservers.net<\/code>. <\/p>\n<p>Since I was not able to add the PGP public key of docker's apt repository, I was not able to continue with the <code>apt-get update<\/code> command further down the guide.<\/p>\n<h3>Looking for the PGP public key of docker's apt repository server at p80.pool.sks-keyservers.net<\/h3>\n<p>Since I was not able to get the PGP public key automatically with the apt-key command inside my Ubuntu server, I thought about trying to add the key manually on my Ubuntu server. <\/p>\n<p>I first tried to use my browser on my Windows machine to access the url specified by the <code>--keyserver<\/code> flag of the <code>apt-key<\/code> command. With that, I got to know that there is a web server running at <a href=\"http:\/\/p80.pool.sks-keyservers.net\" title=\"OpenPGPkeyserver \" target=\"_blank\">p80.pool.sks-keyservers.net<\/a>.<\/p>\n<p>My browser returned me a web page with a search box and two buttons - \"Search Key\" and \"Submit Key\". Since I wanted to get the contents of the public PGP key of docker's apt repository, I typed \"docker\" into the search box, hit the \"Search Key\" button and was returned with a list of PGP public keys. And since I had indicated <code>58118E89F3A912897C070ADBF76221572C52609D<\/code> via the <code>--recv-keys<\/code> flag in the <code>apt-key<\/code> command, I get my browser to find the section that contains the string \"5811\".   <\/p>\n<p>Indeed, there were some results and my browser highlighted the portion containing the \"5811\". I click on the first link in the section that contains \"Fingerprint=5811 8E89 F3A9 1289 7C07  0ADB F762 2157 2C52 609D\" and was returned with a page that displays the PGP public key that I was looking for.<\/p>\n<h3>Creating a physical file of the public PGP key<\/h3>\n<p>I then proceeded to create a physical file in my Ubuntu server via the <code>vi<\/code> editor. <strong>Note that the display page contains text that was irrelevant for the apt-key command<\/strong>. The PGP public key consists of only the following chunk:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nVersion: SKS 1.1.5+\r\nComment: Hostname: aes.keys.peer.sh\r\n\r\nmQINBFWln24BEADrBl5p99uKh8+rpvqJ48u4eTtjeXAWbslJotmC\/CakbNSqOb9oddfzRvGV\r\neJVERt\/Q\/mlvEqgnyTQy+e6oEYN2Y2kqXceUhXagThnqCoxcEJ3+KM4RmYdoe\/BJ\/J\/6rHOj\r\nq7Omk24z2qB3RU1uAv57iY5VGw5p45uZB4C4pNNsBJXoCvPnTGAs\/7IrekFZDDgVraPx\/hdi\r\nwopQ8NltSfZCyu\/jPpWFK28TR8yfVlzYFwibj5WKdHM7ZTqlA1tHIG+agyPf3Rae0jPMsHR6\r\nq+arXVwMccyOi+ULU0z8mHUJ3iEMIrpTX+80KaN\/ZjibfsBOCjcfiJSB\/acn4nxQQgNZigna\r\n32velafhQivsNREFeJpzENiGHOoyC6qVeOgKrRiKxzymj0F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Nrr5HWXPHXITX660jglyshch6CWeiUATqjIAzkEQ\r\nom\/kEnOrvJAtkypRJ59vYQOedZ1sFVELMXg2UCkD\/FwojfnVtjzYaTCeGwFQeqzHmM241iuO\r\nmBYPeyTY5veF49aBJA1gEJOQTvBR8Q==\r\n=Fm3p\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n<\/pre>\n<p>After I saved the file on my Ubuntu server as 58118E89F3A912897C070ADBF76221572C52609D.key in my current working directory, I proceeded to add it into the APT key store on my Ubuntu server.<\/p>\n<h3>The command to manually add the public PGP key of docker's apt repository at Ubuntu's Advanced Packaging Tool key store<\/h3>\n<p>With everything in place, I ran the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-key add 58118E89F3A912897C070ADBF76221572C52609D.key\r\n<\/pre>\n<p>The command returns the string \"OK\" and I was able to continue with the installation of docker-engine on my Ubuntu server.<\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-7l\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7l&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7l&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F455&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p>I was trying to install docker on my Ubuntu server as an initial step to set up a continuous integration server for my Python project. As I was following through <a target=\"_blank\" title=\"Docker reference to install docker engine on Ubuntu\" href=\"https:\/\/docs.docker.com\/engine\/installation\/ubuntulinux\/\">the guide provided by docker<\/a>, I was not able to proceed with adding the public PGP key of docker&#8217;s apt repository at Ubuntu&#8217;s Advanced Packaging Tool (APT) key store automatically. This post describes what I did to manually add the public PGP key to the APT key store.<\/p>\n","protected":false},"author":1,"featured_media":1282,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[221,195,222],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/Ubuntu-Logo.gif","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-7l","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/455"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=455"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1282"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}