Software >> OS >> Unix >> Linux >> yum >>  How to configure yum to connect to repository via a proxy server

 

How do I use a yum server if my system is behind a proxy server?

A: To configure yum to use a proxy for all users on a systen, add your proxy server details to /etc/yum.conf. Note that both a http://or https:// prefix and TCP port are required.

     proxy=http://proxy.mydomain.com:8080

If your proxy server requires authentication, add these settings to /etc/yum.conf:

      proxy_username=<proxy username>
      proxy_password=<proxy password>

To configure a proxy server for a single user or session, set the https_proxy or http_proxy environment variable and optionally add these settings to ~/.bash_profile. Note that a protocol prefix is optional:

      https_proxy=proxy.mydomain.com:8080
      export https_proxy

If you've configured proxy settings for a non-root user or session only, remember that many yum commands require root privileges. So, when using sudo, you must use -E to preserve the existing environment. For example:

      sudo -E yum install <some package>