How to Install Tor and Tor Browser in Ubuntu 22.04, Ubuntu 20.04 [with Bug-fix]

Last updated: August 16, 2023

This is a beginner’s guide shows how to install and setup Tor service and Tor Browser in Ubuntu 20.10, Ubuntu 20.04, Linux Mint 20. It should also work in Ubuntu 18.04 and Ubuntu 16.04.

UPDATE May 2022: This tutorial is tested and works in Ubuntu 22.04 LTS.

Tor, The Onion Router, is a free and open-source service enables people to browser the internet anonymously. While Tor in Ubuntu main repositories is always old, here’s how to install the LATEST version and receive updates via its apt repository.

How to Install Tor via the Official Apt Repository:

Tor has an official apt repository that supports for all current Ubuntu and Debian releases.

1.) Open terminal from system application launcher. Then run command to enable the usage of https in sources.list:

sudo apt install apt-transport-https

Type user password (no asterisk feedback) for sudo prompt and hit Enter.

2.) Run command to add the Tor repository:

sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/] $(lsb_release -sc) main" >> /etc/apt/sources.list.d/tor-project.list'

NOTE 1: For arm64 (e.g., Rasperry Pi), 32-bit Ubuntu 18.04/16.04, you have to remove [arch=amd64] from the command.
NOTE 2: For Linux Mint and other Ubuntu based systems, replace $(lsb_release -sc) in the command with the Ubuntu code-name (e.g, focal, bionic, jammy) that your system based on.

3.) The keyring updates regularly and there’s no valid command to install it so far. As an alternative, download the latest keyring .deb package from the link below:

Then install it via double-click, gdebi, or by running command in terminal:

sudo apt install ./Downloads/*.deb

4.) Finally, refresh package cache and install Tor via 2 commands:

sudo apt update

sudo apt install tor

Or update it, if an old version was installed, via Software Updater

5.) Once installed, you can check Tor version and if it’s running via commands:

tor --version

systemctl status tor

How to Install Tor Browser in Ubuntu:

If everything goes OK, let’s now install the Tor web browser.

1.) Simply open terminal and run command:

sudo apt install torbrowser-launcher

UPDATE: Due to package bug in Ubuntu 22.04, it may refuse to launch. To workaround it, open ‘terminal’ and run command to edit the ‘‘ (2 underscores before & after ‘init’) file:

sudo gedit /usr/lib/python3/dist-packages/torbrowser_launcher/

When the file opens, change the line 98, 99, 100 and save it:

(desktop.width() – window_size.width()) // 2,
(desktop.height() – window_size.height()) // 2

2.) Then search for and open Tor Browser from system application launcher. It will automatically download & install the browser in your system.

You can also open Tor Browser Launcher and select a mirror

3.) Once the download process finished, select ‘Configure’ if you’re in a Country censors Tor or behind proxy in next window, or select ‘Connect’:

When everything’s done, the Tor browser starts. That’s all. Enjoy!

Uninstall Tor and Tor Browser:

To remove Tor Browser, open terminal and run command:

sudo apt remove torbrowser-launcher

To remove Tor network service, run command:

sudo apt remove --autoremove tor

The ‘Software & Updates -> Other Software‘ seems no longer display software repositories added via “signed-by” argument. To remove the repository, use command to remove the source file:

sudo rm /etc/apt/sources.list.d/tor-project.list

Also, remove the keyring files via command:

sudo rm /usr/share/keyrings/

And, finally refresh system package cache via sudo apt update command.


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee:

21 responses to How to Install Tor and Tor Browser in Ubuntu 22.04, Ubuntu 20.04 [with Bug-fix]

  1. I dual boot with Parrot OS. It comes with Tor and Tor browser as a default and optimized for privacy and security. It also has anon surf which helps hide your IPv4 and IPv6 addresses. It is probably the easiest way to set up the Onion network and Tor.

  2. Or you can run Arch which is a distribution that gets the freshest packages for everything every day. You can make some articles about Arch Linux too.
    Having Tor installed in Arch gets it update with every update.

  3. Thank you very much! The whole process worked like a charm on Ubuntu 20.04.

  4. Thanks so much for this guide! Tor is up and running, after a little detour. I initially ran the command to install the Tor repository, taking note 2 into account (manually replacing lsb_release -sc with my version). But further steps didn’t seem to like the format of tor-project.list. I wound up deleting the line in that file that was created originally and reran the command with (lsb_release -sc) intact, and it worked.

    I have a question about the benefit of installing the Tor service. It appears I can use the Tor browser after stopping the Tor service. So I’m curious if the service needs to be running constantly. Could users obtain the full benefits of the Tor browser without first installing the service?

  5. typical linux bs…. more interested in demonstrating brilliance than installation….

  6. how i can install tor browser on my raspberry pi4 using ubuntu 2.0 foca????

  7. Thx again, works as a charm!

  8. Ji m,
    Very few instructions are as good as yours. It simply works!
    Thanks a lot!

  9. on Ubuntu 22.04, the step to install the keyring deb doesnt work, results in following error:

    E: Unsupported file /Home/[username]Downloads/ given on commandline


  10. Bonjour,
    Why this ?

    $ sudo apt install ./Downloads/*.deb
    Lecture des listes de paquets… Fait
    E: Le fichier donné ./Downloads/*.deb n’est pas compris sur la ligne de commande

    What do I have to do ?
    Tor has been removed because of installation of ubuntu 22.04.
    Ubuntu 22.04 deleted Tor.


    • Check that the path is OK.
      It seems that it cannot locate the file.
      (previously, make sure you actually downloaded it, obviously)
      If for instance you use French names for the main directories maybe Downloads is not called Downloads

  11. Nice tutorial, worked as a charm :)

  12. Hi there,

    I just wanted to say thanks for this post. I’m currently using Ubuntu 20.04 and I’m having some trouble installing Tor and Tor Browser. I’ve tried following the instructions on the website, but I keep

  13. mic@mic-OptiPlex-7050:~$ tor –version
    Command ‘tor’ not found, but can be installed with:
    sudo apt install tor
    mic@mic-OptiPlex-7050:~$ sudo apt install tor
    [sudo] password for mic:
    E: Malformed entry 2 in list file /etc/apt/sources.list.d/tor-project.list (Component)
    E: The list of sources could not be read.

    • Try editing the source file via command:

      sudo gedit /etc/apt/sources.list.d/tor-project.list

      Replace gedit with your system text editor if it does not work, or use nano command line text editor instead.

      When file opens in text editor, make sure has only single line looks like:

      deb [arch=amd64 signed-by=/usr/share/keyrings/] jammy main

      Depends on your system, replace jammy with:

      • jammy for Ubuntu 22.04, Linux Mint 21, Elementary OS 7, etc.
      • kinetic for Ubuntu 22.10 and its based systems.
      • focal for Ubuntu 20.04 based systems.
      • bionic for Ubuntu 18.04 based systems.

      Finally update package index via sudo apt update command.

  14. I’m afraid it no longer works. With Python 3.5 you receive a TypeError. They did a binary open that causes the problem

    Traceback (most recent call last):
    File “/usr/bin/torbrowser-launcher”, line 30, in
    File “/usr/lib/python3/dist-packages/torbrowser_launcher/”, line 72, in main
    common = Common(tor_browser_launcher_version)
    File “/usr/lib/python3/dist-packages/torbrowser_launcher/”, line 64, in __init__
    File “/usr/lib/python3/dist-packages/torbrowser_launcher/”, line 310, in load_settings
    self.settings = pickle.load(open(self.paths[‘settings_file_pickle’]))
    TypeError: a bytes-like object is required, not ‘str’

    • As far as I know, only Ubuntu 16.04 defaults to Python 3.5. And, the “torbrowser-launcher” package in Ubuntu 16.04 uses Python 2. So, I’m a little confused about the error.

      Anyhow, for the error output your provided, try to fix it with following steps:

      1. Open terminal (press Ctrl+Alt+T on keyboard)
      2. Edit the key file by running command (replace gedit if you’re not on default DE):

      sudo gedit /usr/lib/python3/dist-packages/torbrowser_launcher/

      3. When file opens in text editor, scroll down and find out line 310.
      4. Replace the line:

      self.settings = pickle.load(open(self.paths[‘settings_file_pickle’]))

      with (try ‘rb’, ‘wb’, ‘rt’, ‘wt’ in below line one by one):

      self.settings = pickle.load(open(self.paths[‘settings_file_pickle’], 'rb'))

      Finally, save the file and re-run the torbrowser-launcher. I’m not an expert on Python, so it may or may not work.

  15. I followed each and every step from your tutorial but when i launched the tor browser i got 404 error. how to get rid of this.

  16. It did not work in ubuntu 22/4

  17. when i ran the first command it worked. The second command i forgot to sub the $(lsb_release -sc). The second time i substituted it with focal but for some reason it didnt work. maybe it was a typo but when i went back to retry the whole thing i couldnt make it past the first command because after it was executed i got and error that read, malformed entry 1 in list file /etc/apt/sources.list.d/tor-project.list (component). Anyway, im a total noob, just downloading ubuntu today so i have no clue what i did wrong.

    • Try editing the source file via:

      sudo nano /etc/apt/sources.list.d/tor-project.list

      Then, change the code-name according to your system (Run lsb_release -sc command will output your system code name).