Tag Archives: enable proxy in yum

How to configure proxy for YUM in RHEL, CentOS ?

A quick tutorial to configure a proxy for YUM in RHEL, CentOS, or Fedora Linux.

Proxy configuration in YUM in RHEL, CentOS, Fedora

1. Enable proxy for yum in configuration file. (global)

If your server is connected to the internet via proxy server then you can define it in the configuration file located at /etc/yum.conf. For a definition, you should have below details ready with you  –

  1. Proxy server IP or hostname
  2. Port to be used for proxy connectivity
  3. User ID and password for authenticating you at proxy if enabled on proxy

Now, edit /etc/yum.conf using any text editor like vi and edit below parameters :

proxy=http://kerneltalksproxy.com:3487
proxy_username=shrikant
proxy_password=funWif#92cE

where –

kerneltalksproxy.com: Proxy server name
3487: Port
Username for proxy authentication: shrikant
Password for proxy authentication: funWif#92cE

Save and exit. List repo to verify internet connectivity using yum repolist.

Using this method you are configuring proxy within YUM configuration which will be used or available for all users on the system whenever they use yum commands.

2. Using profile proxy (User specific)

If you don’t want global proxy setup through /etc/yum.conf file then you can opt to define proxy at the user level by defining it in the user’s individual profile files. Add below config in .profile ( .profile file has different names depends on which login shell you are using) of the user so that it will be loaded every time user logged in to the system.

http_proxy="http://shrikant:funWif#92cE@kerneltalksproxy.com:3487" 
export http_proxy

If the proxy doesn’t need authentication then you can remove username, password portion and configure rest of the part –

http_proxy="http://kerneltalksproxy.com:3487" 
export http_proxy

So, this proxy setting will be available for all applications who use system proxy (like curl, yum) under that user’s login. Ask the user to login and verify proxy by refreshing yum repo.