Apt-get update through Tor

I'm trying to update my apt-get list. In my country a lot of sites are blocked or have been blocked from companies.

When I use a proxy for the whole system I get errors, Tor works perfectly when browsing. Can I update apt-get through a connection from Tor? I mean I want to unblock the blocked sites using Tor connection, so I can perform apt-get update without errors.

Edit: I'm using Ubuntu 13.10 and Tor 0.2.21

$ sudo apt-get update
[sudo] password for alexander: 
Ign http://extras.ubuntu.com saucy InRelease                                   
Ign http://security.ubuntu.com saucy-security InRelease                        
Ign http://us.archive.ubuntu.com saucy InRelease                               
Hit http://extras.ubuntu.com saucy Release.gpg                                 
Get:1 http://dl.google.com stable InRelease [1,540 B]
100% [1 InRelease gpgv 1,540 B] [Waiting for headers] [Waiting for headers]        
[WaSplitting up/var/lib/apt/lists/partial/dl.google.com_linux_chrome_deb_dists_stabIgn  
http://dl.google.com stable InRelease                                      
E: GPG error: http://dl.google.com stable InRelease: Clearsigned file isn't valid, 
got 'NODATA' (does the network require authentication?

Install the apt-transport-tor package and then:

Edit /etc/apt/sources.list to add the prefix tor+ to your repositories.

deb     tor+http://deb.debian.org/debian unstable main
deb-src tor+http://deb.debian.org/debian unstable main

This will allow apt to run over tor.

Note: Substitute http://deb.debian.org/debian unstable main with the appropriate sources for your distribution.


You can use torsocks, It's shell wrapper to torify applications, to simplify the use of the Tor socks.

torsocks apt-get update

You must remove http://dl.google.com from apt source the first way is remove from software center or edit /etc/apt/sources.list with root access,Read it.

and if you use the kubuntu you can use software center and choose source tap click on configure source software and choose other tab remove http://dl.google.com.

and after than :

sudo apt-get clean
sudo apt-get update

If you have installed Tor from terminal, you must have torify. If so, simply you can pass the traffic of any script or program from tor.

First become root using sudo su then run this:

torify apt-get update

Then you can update your Google Chrome in the regular way using

apt-get upgrade

I am in Iran so facing with same problem of yours. I just used this method to update my Chrome.