0x01 环境变量设置
设置代理
echo 'export https_proxy="http://127.0.0.1:7890"' >> ~/.bashrc
echo 'export http_proxy=$https_proxy' >> ~/.bashrc
echo 'export ftp_proxy=$https_proxy' >> ~/.bashrc
echo 'export proxy=$https_proxy' >> ~/.bashrc
echo 'export HTTPS_PROXY=$https_proxy' >> ~/.bashrc
echo 'export HTTP_PROXY=$https_proxy' >> ~/.bashrc
echo 'export FTP_PROXY=$https_proxy' >> ~/.bashrc
echo 'export PROXY=$https_proxy' >> ~/.bashrc
取消代理
vim ~/.bashrc # 编辑.bashrc文件删除或注释代理设置;
apt 代理设置
设置代理
echo 'Acquire::http::proxy "http://127.0.0.1:7890";' | tee -a /etc/apt/apt.conf
echo 'Acquire::https::proxy "https://127.0.0.1:7890";' | tee -a /etc/apt/apt.conf
取消代理
vim /etc/apt/apt.conf # 编辑apt.conf文件删除或注释代理设置;
wget 代理设置
设置代理
echo 'https_proxy=http://127.0.0.1:7890' | tee -a /etc/wgetrc
echo 'http_proxy=http://127.0.0.1:7890' | tee -a /etc/wgetrc
echo 'ftp_proxy=http://127.0.0.1:7890' | tee -a /etc/wgetrc
echo '#check_certificate = off' >> ~/.wgetrc
取消代理
vim /etc/wgetrc # 编辑wgerrc文件删除或注释代理设置;
0x04 curl 代理设置
设置代理
echo 'proxy = "http://127.0.0.1:7890"' >> ~/.curlrc
echo '#insecure' >> ~/.curlrc
取消代理
vim ~/.curlrc # 编辑curlrc文件删除或注释代理设置;
0x05 git 代理设置
设置代理
git config --global https.proxy http://127.0.0.1:7890
git config --global http.proxy http://127.0.0.1:7890
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
取消代理
git config --global -l # 查看git设置;
git config --global -e # 编辑git设置,删除设置;
0x06 pip 代理设置
pip 代理命令语法
pip [command] --proxy http://[address]:[port] [arg]
代理安装pyperclip示例
pip install --proxy http://127.0.0.1:7890 pyperclip
0x07 docker 代理设置
设置代理
mkdir /etc/systemd/system/docker.service.d
echo '[Service]' | tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
echo 'Environment="HTTP_PROXY=http://127.0.0.1:7890"' | tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
systemctl daemon-reload
systemctl restart docker
取消代理
vim /etc/systemd/system/docker.service.d # 编辑docker.service.d文件删除或注释代理设置;