I am updating my Tor on Ubuntu and it states:

Do not use the packages in Ubuntu's universe. You'll need to set up our package repository before you can fetch Tor.

It then states that I have to add this line to your /etc/apt/sources.list file:

 deb http://deb.torproject.org/torproject.org <precise> main

I am uncertain how to add a line to /etc/apt/sources.list.

6 Answers 6


Make a backup copy of your current sources.list file

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

Append new line of text to current sources.list file

  • CLI

    echo "new line of text" | sudo tee -a /etc/apt/sources.list
  • GUI (Text Editor)

    sudo gedit /etc/apt/sources.list
  • Paste new line of text on new line at end of current sources.list text file in Text Editor.

  • Save and close sources.list

Don't forget to update in order to use the new repository

sudo apt-get update

In order to add a third-party repository, you first need the public keys for this repository which in this case you can grab from the Ubuntu key server:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 886DDD89

Now you can add the repository in /etc/apt/sources.list.d/ with add-apt-repository:

sudo add-apt-repository "deb http://deb.torproject.org/torproject.org $(lsb_release -s -c) main"

After adding any repository it is always needed to execute

sudo apt-get update

Now you can install the package for Tor itself. For complete instructions on how to install Tor correctly, see How to install Tor?

This procedure can also be reversed.

  • 7
    +1, do not use /etc/apt/sources.list for third-party repos, use /etc/apt/sources.list.d/ instead.
    – hudolejev
    Nov 1, 2012 at 21:44
  • @hudolejev how do you specify a file in the /etc/apt/sources.list.d/ using the command add-apt-repository? From the man page I can not figure it out it seems like it happens magically, however when using that command I keep seeing lines added to the file /etc/apt/sources.list instead
    – TPPZ
    Aug 8, 2018 at 10:50
  • @TPPZ my previous comment is 6 years old, I don't quite remember the context. Maybe it was and answer to some other comment that is now deleted :/ Anyways, seems that add-apt-repository will only create separate files in sources.list.d for PPA repos, for others it will update sources.list: manpages.ubuntu.com/manpages/bionic/man1/…
    – hudolejev
    Sep 5, 2018 at 6:39

Easiest way on Ubuntu:

Go to Ubuntu Software Centre > Edit > Software Sources > Add

Paste the line from the Tor website into the APT line box.

You could also manually edit /etc/apt/sources.list, but probably simplest to go through the Software Centre.

Make sure to input the line correctly as well, e.g.

deb http://deb.torproject.org/torproject.org precise main

if you're using 12.04. If something goes wrong edit /etc/apt/sources.list to fix it.


First, make a backup. You can do so with:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

in the Terminal. Give your password and press Enter. It will not be shown, not even asterisks. Then run:

gksudo gedit /etc/apt/sources.list

and give your password.

Add the line:

 deb http://deb.torproject.org/torproject.org main

to the bottom of the file and use File->Save to save it.

Then, go back to the terminal and run:

sudo apt-get update

and then continue following the instructions. This command and the one starting in sudo apt-get install may take a while. Additionally, the install command may give a:

Do you want to continue[y/n]?

prompt, where you must type y and press Enter to continue.


You need not to edit default /etc/apt/sources.list, you better upgrade your Ubuntu to Saucy. Here Tor is in the official repository.

See, my /etc/apt/sources.list:

deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ saucy main restricted universe multiverse
deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ saucy-updates main restricted universe multiverse
deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ saucy-security main restricted universe multiverse

Only 4 lines.

I'm able to download and install the Tor package:

# aptitude download tor
Get: 1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ saucy/universe tor amd64 [953 kB]
84% [1 tor 799 kB/953 kB 84%]201 URI Done: http://us-west-2.ec2.archive.ubuntu.com/ubuntu/pool/universe/t/tor/tor_0.2.3.25-1_amd64.deb
RecivedHash: MD5Sum:1cb3ed029c169c3a5e528dd7d28cc60f
ExpectedHash: MD5Sum:1cb3ed029c169c3a5e528dd7d28cc60f

Fetched 953 kB in 4s (198 kB/s)

According to http://torstatus.blutmagie.de Tor on Linux, one of the common installations.


Basically sources.list is a text file you want to edit. Linux is all about file you can customize your ubuntu by changing files. so the basic way to edit files(adding or deleting text) is by using some of the text editor like:

  • emacs,gedit(gui based)
  • nano,vi,vim(cli based)

You can install them by typing sudo apt-get install text_editor_name.

type man text_editor_name for reading their mannual pages.

  • If the status is you don't hav permissions, use:

    chmod 777 filename

  • 2
    why don't you just use sudo and not changing the permissions? Aug 12, 2015 at 10:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .