Linux Proxy Command Line

Step 2: Configure http proxy privoxy

Some command-line tools only support http proxy, not socks5 proxy. Therefore, privoxy is needed to convert socks5 proxy to http proxy.

Install privoxy

sudo apt install -y privoxy

Edit configuration file /etc/privoxy/config

listen-address :10809
forward-socks5 / 127.0.0.1:10808 .

Start privoxy service

systemctl restart privoxy

http proxy is now running on default port 10809 (http://127.0.0.1:10809).

Step 3: Configure proxychains

Some Linux command-line tools do not have a method to configure a proxy. Proxychains can be used to force applications to use proxy network.

Install proxychains

sudo apt install -y proxychains

Edit the last line of /etc/proxychains.conf

socks5 127.0.0.1 10808

Usage: prepend proxychains to the command, e.g.:

proxychains apt update

Python pip using http proxy to accelerate

Method 1:
pip3 install -r requirement.txt --proxy http://127.0.0.1:10809
Method 2:
proxychains pip3 install -r requirement.txt

Git using http proxy to accelerate

Method 1:
git config --global http.proxy http://127.0.0.1:10809
git config --global https.proxy http://127.0.0.1:10809

Unset

git config --global --unset http.proxy
Method 2:
proxychains git clone https://github.com/opencv/opencv.git

Docker using http proxy to accelerate

mkdir -p /etc/systemd/system/docker.service.d
/etc/systemd/system/docker.service.d/http-proxy.conf
------
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:10809/"
------
# systemctl daemon-reload
# systemctl restart docker

评论

暂无评论。

登录后可发表评论。