To redirect all HTTP and HTTPS traffic to proxy server, set the following parameter –

[hstan@devel ~]$ http_proxy=http://proxy-url:3128
[hstan@devel ~]$ export http_proxy

To confirm the variable is set correctly you can use the “echo” command:
[hstan@devel ~]$ echo $http_proxy
http://proxy-url:3128

where proxy-url is ip or url of the proxy server, and 3128 is the port.

To configure “yum” to use the HTTP / HTTPS proxy you will need to edit the /etc/yum.conf configuration file. Open /etc/yum.conf in your favorite editor and add the following line.

proxy=http://proxy-url:3128

Save and close the file, then clear the cache used by yum with the following command:

yum clean all

To enable it every time login to root, add the above command to bash profile :
~/.bash_profile

Add :

http_proxy=http://proxy-url:3128
export http_proxy