Ubuntu: How do I add a line to my /etc/apt/sources.list?
Channel: Roel Van de Paar
Date: 2019-06-18

Ubuntu: How do I add a line to my /etc/apt/sources.list?


Question: 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.

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 1 person ==
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.

== This solution helped 1 person ==
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.

== This solution helped 29 people ==
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 http://apt.ubuntu.com/p/tor itself. For
complete instructions on how to install Tor correctly, see How_to_install_Tor?
This procedure can also be https://askubuntu.com/questions/313907/how-to-
remove-a-particular-ppa.

== This solution helped 47 people ==
***** 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

With thanks & praise to God! With thanks to all the many who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music & music license: https://www.bensound.com/royalty-free-music | Images & images license: https://stocksnap.io/license and others | With thanks to user zerwas (https://askubuntu.com/users/2906), user user2496 (https://askubuntu.com/users/248879), user penreturns (https://askubuntu.com/users/71205), user ngm (https://askubuntu.com/users/10271), user klint (https://askubuntu.com/users/95231), user jtd (https://askubuntu.com/users/239240), user hexafraction (https://askubuntu.com/users/54298), user Braiam (https://askubuntu.com/users/169736), and the Stack Exchange Network (http://askubuntu.com/questions/197564). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.