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.conf
file using a text editor:
sudo nano /etc/yum.conf
- Add the following lines to the file, replacing
PROXY_HOST
andPROXY_PORT
with the hostname and port number of your proxy server:
proxy=http://PROXY_HOST:PROXY_PORT
- Save and close the file.
- Verify that the
yum
command is using the proxy server by running the following command:
yum info yum
If 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_PORT
Note 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.