由于各种墙的存在, 我们不得不学会设置代理, 这里总结下不同软件设置代理的方法.
curl
curl -x 127.0.0.1:8080 abc.zip
git
git config --local http.proxy 127.0.0.1:8899
git config --local https.proxy 127.0.0.1:8899
系统(适用apt-get)
export _proxy='http://127.0.0.1:8889'
export s_proxy='https://127.0.0.1:8889'
export HTTP_PROXY=$_proxy
export HTTPS_PROXY=$s_proxy
export FTP_PROXY=$proxy
export NO_PROXY="localhost,127.0.0.1,::1,10.0.0.0/8"
echo 'set HTTP_PROXY and HTTPS_PROXY'
还有一种方法是修改/etc/apt/apt.conf
Acquire::http::proxy "http://127.0.0.1:8080";
Acquire::ftp::proxy "http://127.0.0.1:8080";
Acquire::https::proxy "http://127.0.0.1:8080";
docker中git设置代理
这里172.17.0.1
是docker的ip地址.
RUN git config --global https.proxy "https://172.17.0.1:8889" && git config --global http.proxy "http://172.17.0.1:8889"
pip
pip install --proxy=http://127.0.0.1:8080 -i https://pypi.tuna.tsinghua.edg.cn/simple you_package