在 CentOS 7 中设置系统级代理需要几个步骤。以下是设置系统级代理的方法:
- 设置环境变量:
编辑 /etc/environment
文件:
sudo nano /etc/environment
添加以下行(替换 proxy_server 和 port 为您的实际代理服务器地址和端口):
http_proxy="http://proxy_server:port"
https_proxy="http://proxy_server:port"
ftp_proxy="http://proxy_server:port"
no_proxy="localhost,127.0.0.1,::1"
HTTP_PROXY="http://proxy_server:port"
HTTPS_PROXY="http://proxy_server:port"
FTP_PROXY="http://proxy_server:port"
NO_PROXY="localhost,127.0.0.1,::1"
- 为 Yum 包管理器设置代理:
编辑 /etc/yum.conf
文件:
sudo nano /