Debian 常用软件代理设置

最近在使用 Debian 编译黑群晖的引导,就遇到让我非常头疼的代理设置问题。本以为部署了代理,设置了系统变量的代理就 ok 了。结果在我编译的过程中仍旧是有各个软件报错,都是代理错误。经过摸索原来只设置系统变量并不能让软件使用代理。还需要配置软件的代理,在给软件配置了代理后还是有其他的问题需要注意,就是你使用代理是否支持 https 否者就是各种让你头大的问题。

下面是我在编译过程中使用到软件的代理设置,如果你也有代理配置方面的问题可以作为参考。抄作业也要有技巧,不要全抄根据你自己的环境来修改。一下的代理设置在终端中一行一个执行。

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文件删除或注释代理设置;

0x02 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文件删除或注释代理设置;

0x03 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文件删除或注释代理设置;
相关推荐
python ERROR: Command errored out with exit status 1:
Windows Server 2016 搭建 SMB 共享文件
Windows Server 2019 域环境搭建 SMB 共享文件服务
Parallels Desktop 15.1.3