How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
In most of the data center direct Internet connection is not allowed on Unix and Windows Servers. If we need to download anything from Internet we have to go through via some proxy servers. In case of Linux Servers whenever we need to install new packages and apply patches in such scenarios we have to set proxy for yum command.
This can be easily achieved with yum config file “/etc/yum.conf“. Under main section define the proxy settings like below:
[main] ……………… proxy=http://<Proxy-Server-IP-Address>:<Proxy_Port> proxy_username=<Proxy-User-Name> proxy_password=<Proxy-Password> ………………
Save and exit the file and start using the yum command. Sample yum Config file with proxy settings is shown below :
Just for the verification you can run beneath command to see whether you are able to fetch the packages or not.
[root@linuxtechi ~]# yum repolist
Alternate way to configure proxy settings for yum command
Set the following variables in either of the file “/etc/environment” or “/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 ftp_proxy= http://{Proxy-User-Name}:{Proxy-Password}@<Proxy-Server-IP-Address>:<Proxy-Port> export no_proxy=127.0.0.1,localhost ...................................................................
Above proxy settings will be applicable system wide.