Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

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
share|improve this answer
1  
I edited your answer. The term sudo something >> file will not work. The best hack is to use tee. –  qbi Nov 1 '12 at 13:07
1  
@qbi: That should be sudo tee. –  Mechanical snail Nov 1 '12 at 19:06
    
@Mechanicalsnail Sorry, I forgot sudo. You are right. –  qbi Nov 1 '12 at 21:17

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?

share|improve this answer
    
+1, do not use /etc/apt/sources.list for third-party repos, use /etc/apt/sources.list.d/ instead. –  hudolejev Nov 1 '12 at 21:44

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.

share|improve this answer

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.

share|improve this answer

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 0.2.3.25-1 [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 0.2.3.25 on Linux, one of the common installations.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.