Use apt-get behind a socks5 proxy
Nothing would be more frustrating than to install apt packages from sources outside of China, especially from PPA.
If you try to update the c++ compiler to g++-6
or g++-7
through
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install g++-7 -y
it may takes your hours to get it done.
But if you have a socks5 proxy out there, things will become better. The idea is to use apt-get
behind a socks5 proxy.
tsocks
and proxychains
are common-used tools for this purpose. Here I choose proxychains
over tsocks
due to the DNS issue of tsocks
mentioned by this.
- install
proxychains
sudo apt-get install proxychains
- setup for
proxychains
in/etc/proxychains.conf
Since my socks5 proxy server is running at127.0.0.1
through port1080
, my setting issocks5 127.0.0.1 1080
at the last line of
/etc/proxychains.conf
. - using
proxychaines
withapt-get
sudo proxychains apt-get update sudo proxychains apt-get install g++-7 -y
Done in minutes!
You can also use the proxychains for other software as below:
sudo proxychains synaptic
proxychains julia
Enjoy!
Leave a Comment