How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers

编辑yum的配置文件:/etc/yum.conf

proxy=http://<Proxy-Server-IP-Address>:<Proxy_Port>
proxy_username=<Proxy-User-Name>
proxy_password=<Proxy-Password>


还有一种配置方法:

在 “/etc/environment” 或者 “/root/.bashrc” 文件里面配置变量

export http_proxy=http://{Proxy-User-Name}:{Proxy-Password}@<Proxy-Server-IP-Address>:<Proxy-Port>
export https_proxy= http://{Proxy-User-Name}:{Proxy-Password}@<Proxy-Server-IP-Address>:<Proxy-Port>
export no_proxy=127.0.0.1,localhost


然后执行命令

source /etc/environment


这个配置会将你整个系统都使用代理。

参考资料:

> How to enable Proxy Settings for Yum Command on RHEL/CentOS