In order to download anonymously (whether it’s for free speech reasons, to bypass IP-based restrictions, or for other reasons) the TOR Project provides the perfect solution, and it’s really easy to use from the command line. On CentOS or RedHat Linux, the best way to get tor is to download it from the EPEL repository. Simply install EPEL and then install tor:
yum install epel-release
yum install tor
You can configure the various options by editing files in the /etc/tor
folder, however the defaults are fine for our uses, so we won’t change
anything. Once configured, you have to start the service. This will
create a SOCKS proxy for you to use:
systemctl start tor
Note that this takes a minute to start, because the service needs to start the proxy and then connect to the tor directory node. Monitor the startup sequence to know when it’s done setting itself up:
systemctl status tor
Once the service is running, you can use the torsocks
binary to fetch something from the Internet over that tor proxy. For example, here we will use youtube-dl
to download a video file:
torsocks youtube-dl --prefer-free-formats http://www.example.com/some_video.mp4
At the end, I would suggest stopping the tor proxy when you don’t need it:
systemctl stop tor
That’s it!