This post was updated 510 days ago and some of the ideas may be out of date.

打开/etc/profile文件,在文件最后添加

对指定协议生效

export http_proxy="http://<user>:<password>@<proxy_server>:<port>"
export https_proxy="http://<user>:<password>@<proxy_server>:<port>"
export ftp_proxy="http://<user>:<password>@<proxy_server>:<port>"

对所有协议生效

export all_proxy="http://<user>:<password>@<proxy_server>:<port>"
# 使用例子
# export all_proxy="socks://host.docker.internal:10810"

使修改生效

source /etc/profile