Menu icon
RedCrackle
Menu icon
Services
01Design Transformation
About UsCase StudiesBlogContact Us

<

Blog post

How to add an Ubuntu apt-get key from behind a firewall

Neerav Mehta

Founder & CEO

Have you ever tried to install an apt package from a third-party repository from behind a firewall? If you run apt-key command with a key server, firewall will block it. Read this post to find out how to get past the firewall to import key for a third-party apt package.

Apt-get package management uses public key cryptography to authenticate downloaded packages. Each time you add another apt repository to /etc/apt/sources.list, you'll also have to give apt its key if you want apt to trust it. This can easily be done using apt-key command with keys.gnupg.net as keyserver. Here is an example which imports key for Percona XtraDB:

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A

This command contacts the server keys.gnupg.net which in trun redirects to one of umpteen servers which are hosting the key. Behind a firewall, this external request will get blocked. An easy solution to this problem is to import the key manually. Here are the steps to do so:

  1. Go to http://keyserver.ubuntu.com. In the "Search String" textfield, enter the key you want to import. In my case, I entered "1C4CBDCDCD2EFD2A" as shown below. Press "Search".
How to add an Ubuntu apt-get key from behind a firewall
  1. If your key is found, you will see a screen with links to it as shown below.
How to add an Ubuntu apt-get key from behind a firewall

Click on the link in the "pub" section as shown above. You will see the actual key:

How to add an Ubuntu apt-get key from behind a firewall
  1. Copy the key (marked in blue background in the above screenshot) and paste in a file named "keyfile" (you can choose any filename). Now execute the following commands:

sudo apt-key add keyfile
suao apt-get update

Voila! Your key should get imported and now you can proceed with software installation using apt-get install.

Neerav Mehta

Neerav Mehta

Founder & CEO

Neerav Mehta is the Founder & CEO of Red Crackle. With sterling qualities, Neerav’s technological acumen is firing a generation of progressive companies on the digital path. With an undergraduate degree in Electrical Engineering from India's most prestigious institution IIT Bombay and having spent seven years developing and contributing to the launch of AMD's innovative line of computer products, Neerav founded Red Crackle where he is lauded for his dynamic and innovative genius.

View all posts

>

Read Next

10 Tips For Entrepreneurs In 2015

10 Tips For Entrepreneurs In 2015

Learn more

10 Ways To Increase Productivity At Work

10 Ways To Increase Productivity At Work

Learn more

30 best WordPress widgets for your site

30 best WordPress widgets for your site

Learn more

Let’s get you started!

Contact Us

>

RedCrackle

Explore

About Us

Services

Contact Us

Our address

5346 Gerine Blossom Dr,

San Jose, CA 95123

USA

Socials

Twitter
LinkedIn

© 2023 RedCrackle. All rights reserved.