Today, I’ll show you how to install Tor on Debian and Ubuntu, the proper way.

Some might be tempted to just install the Tor package from the official distro repositories, but the Tor Project actually advises against this, especially on Ubuntu, as they haven’t reliably updated Tor in the past, so you could miss out on timely security fixes.

The Tor Project provides an official APT repository, which you can (and should) use instead.

I find the official instructions to be quite cumbersome, so I wrote something for you to copy and paste on Debian and Ubuntu:

apt install apt-transport-https lsb-release wget gpg

wget -qO- | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null

cat <<EOF > /etc/apt/sources.list.d/tor.list
deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] $(lsb_release -sc) main
deb-src [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] $(lsb_release -sc) main

apt update && apt install tor

This should install the required dependencies, download the PGP signing key, install the repository URL for the correct architecture and distro version, and finally update the sources and install Tor (and the keyring). I tested this on Ubuntu 22.04, and it worked flawlessly.

Don’t forget to configure Tor after the installation using the config file /etc/tor/torrc to adjust it to your needs, then restart Tor with systemctl restart tor after making your changes.

I run this blog in my free time, if I helped you out, consider donating a coffee! :D

Further reading