Ubuntu – 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?

Best Answer

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.

Related Question