Monday, April 4, 2011

Install Tor in Ubuntu

(This post is up-to-date with Ubuntu release 12.04).
These are just the steps to install tor and the necessary software to make it run smoothly on your Ubuntu. For detailed info on what each parts does, you can always refer to the tor docs.
1. Add the following to the end of your /etc/apt/sources.list file.
The format here is
deb <distribution> main
Since we are using Ubuntu 12.04 we will use 'precise' for the distribution
deb precise main
2. Import repository GPG key
gpg --keyserver --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get update
To keep the repository key up-to-date, install the debian package
apt-get install
3. Install tor, tor-geoipdb, polipo, privoxy
sudo apt-get install tor tor-geoipdb polipo privoxy
4. To Configure polio, first backup the original.
sudo mv -i /etc/polipo/config /etc/polipo/config.orig
sudo vim /etc/polipo/config
5. Add the following to the file or find those lines and uncomment them.
socksParentProxy = "localhost:9050"
socksProxyType = socks5
diskCacheRoot = ""
disableLocalInterface = true
6. (Optional but recommended) If you want a GUI frontend for tor install vidalia
sudo apt-get install vidalia
Vidalia will show a message on how it should handle tor. You can choose 'complete takeover'.
7. Append the following at the end of /etc/privoxy/config file or uncomment the line
sudo vim /etc/privoxy/config
forward-socks5 / .
Note that there is a space and a dot after 9050
8. Now we have successfully installed and configured the tor and its family, we need to tell the browser to use the network.
Assuming that tor is running else, start tor by
sudo /etc/init.d/tor start
Open firefox, and install tor addon.
If you install the tor button addon, then choose use polipo in the browser network settings.
Else to configure manually goto preference->advanced->network->settings->manual proxy configuration and enter the values for the following
HTTP Proxy: Port: 8118
SSL Proxy : Port: 8118
SOCKS Host: Port: 9050
Choose SOCKSv5
No Proxies for:
And click test settings. If things went well you'll get 'Tor proxy test successful' message.
You can check you IP address to see the difference.
9. Take about:config in the Firefox browser and set the value for network.proxy.socks_remote_dns to true to avoid DNS leaks.
NB: Its better not to run P2P software in tor network. The main purpose of tor is to provide anonymity for browsing. To make the tor network faster, you can consider running a tor relay on your system as well.
I highly recommend using the HTTPS Everywhere extension for firefox from It will make your browser to choose https protocol over http if the target server supports one.