Install tor on Ubuntu Focal

Step 1 - Add the tor Package Repo

Create /etc/apt/sources.list.d/tor.list with the following lines:

deb https://deb.torproject.org/torproject.org focal main
deb-src https://deb.torproject.org/torproject.org focal main

Step 2 - Import GPG key

You need to log in as the root user. gpg --import will only work as root:

$ curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
$ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -

Step 3 - Run apt update

apt update

You’ll get the following error if you didn’t import the key as root:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://deb.torproject.org/torproject.org focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 74A941BA219EC810
W: Failed to fetch https://deb.torproject.org/torproject.org/dists/focal/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 74A941BA219EC810
W: Some index files failed to download. They have been ignored, or old ones used instead.

If you don’t have the privilege to log in as root, fine. Run the following the commands with the key that you got from the error:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 74A941BA219EC810

$ apt-key list | grep torproject

# then re-run

$ apt update

Step 4 - Install tor and its Keyring

apt install tor deb.torproject.org-keyring

The tor service is active and enabled by default. If not, run:

systemctl enable --now tor

“I don't know why people are so keen to put the details of their private life in public; they forget that invisibility is a superpower.”Banksy