Solved:How to Configure Proxy Settings on CentOS / RHEL / Fedora Linux


Scenario 1: To access Internet from the Private Cloud Lab to install packages for CentOS / RHEL / Fedora Linux with Yum.

Yum repositories can be accessed and used to install required packages through standard web proxy servers over HTTP/1.1. There is a proxy server and we need to somehow get through it legally to access packages to install different applications / software.
Configure Proxy Settings on CentOS / RHEL / Fedora Linux

 

 To use yum operations / execute yum commands, we need to specify proxy server details in /etc/yum.conf.
Following settings need to be done:
  • Proxy server as a complete URL with TCP Port number
  • proxy_username
  • proxy_password

 

Login as root user in the terminal and execute vi /etc/yum.conf
Add the following settings in [main] section
# The proxy server
proxy=http://<<proxy_server_url>>:<<port_numer>>
# The account details for yum connections
proxy_username=<<user_name>>
proxy_password=<<password>>
To enable proxy access, do following settings in ~/.bash_profile
http_proxy=http://<<proxy_server_url>>:<<port_numer>>
export http_proxy
Scenario 2: Configure wget to use a proxy server CentOS / RHEL / Fedora Linux
Login and su to root or Login as a root
Verify if environment variable is already set or not using grep command
env | grep -i “proxy”
If it provides old values set into the variables then remove it using unset <env_variable_name>
e.g.
  • unset http_proxy
  • unset https_proxy
  • unset ftp_proxy

 

Now set Environment variable with correct values:
export http_proxy=”<<proxy_url:port>>”
To set Environment variable with user name and password:
export http_proxy=”http://username:password@proxy_url:port”
Make sure that your password must not have “@” character.
We can set it in etc/wgetrc file

Leave a comment

Your email address will not be published. Required fields are marked *