Here we describe how one can install Tor and Tor Browser Launcher on Ubuntu 18. The simplest way to do it is via its official repository. To prepare for the installation, lets add the repository to Ubuntu's list.
sudo nano /etc/apt/sources.list
Add the following lines to the file (for versions of Ubuntu other than 18.04 LTS, these entries will be slightly different)
deb https://deb.torproject.org/torproject.org bionic main deb-src https://deb.torproject.org/torproject.org bionic main
Alternatively, one can create a separate file and add the entries there
sudo nano /etc/apt/sources.list.d/tor-sources.list
After this, we are ready to proceed with the installation itself.
1. Download the encryption key. In case the key is changed upon your reading this article, please navigate to https://deb.torproject.org/torproject.org/ to see the new key. Modify the name of the key in the command accordingly. In our case, we execute
curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc -O
The flag of the command serves to save the key in the current directory.
2. Import the key into GPG
sudo gpg --import A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc
3. Export the key and add it to keyring
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
4. Update packages and install Tor and its components
sudo apt-get update sudo apt-get install tor deb.torproject.org-keyring torbrowser-launcher
5. Try launching Tor Launcher. After a few moments and verifying the key, the browser window should appear
If you happen to get an error about not being able to verify the key, please see the following discussion:
In short, you will need to manually refresh the keyring by executing
gpg --homedir "$HOME/.local/share/torbrowser/gnupg_homedir/" --refresh-keys --keyserver pgp.mit.edu
This can be done either right away or after uninstalling the Tor components. In the latter case, you will need to remove the Tor components installed in 4., refresh the keys and then install the Tor and its components again. The browser should then launch successfully.