CentOS / RHEL / Fedora Linux: Use Yum Command With A Proxy Server
To use the yum command with a proxy server on CentOS, RHEL, or Fedora Linux, you need to modify the /etc/yum.conf file and add the proxy server settings. Here's how you can do this:
- Open the
/etc/yum.conffile using a text editor:
sudo nano /etc/yum.conf- Add the following lines to the file, replacing
PROXY_HOSTandPROXY_PORTwith the hostname and port number of your proxy server:
proxy=http://PROXY_HOST:PROXY_PORT- Save and close the file.
- Verify that the
yumcommand is using the proxy server by running the following command:
yum info yumIf you have a username and password for your proxy server, you can add them to the proxy URL in the following format:
proxy=http://username:password@PROXY_HOST:PROXY_PORTNote that the yum command will use the proxy server for all its operations, including downloading packages and metadata, until you remove or modify the proxy settings in the /etc/yum.conf file.
