You can use a Proxy Server to access Internet at Shell Prompt by setting the http_proxy variable.
This allows you to connect text based session and/or applications via the proxy server.
Setting the proxy via command line
You can set the http_proxy shell variable on Linux/Unix bash shell for the current user by running the command below:
#export http_proxy=http://server-ip:port/
If the proxy server requires a username and password then run:
#export http_proxy=http://username:password@server-ip:port/
Setting the proxy to be available in all shell instances
To set the proxy variable as a global variable for all users:
Add the following line to /etc/profile file:
export http_proxy=http://proxy-server:port/
Below an example to set your proxy settings at once:
PROXY_ADDRESS=”http://server-ip:port/”
HTTP_PROXY=$PROXY_ADDRESS
HTTPS_PROXY=$PROXY_ADDRESS
FTP_PROXY=$PROXY_ADDRESS
http_proxy=$PROXY_ADDRESS
https_proxy=$PROXY_ADDRESS
ftp_proxy=$PROXY_ADDRESS
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
Setting the proxy for a specific user
To enable proxy access for a specific user, add the line to user shell profile:
# vi /home/username/.bash_profile
Add the following line:
export http_proxy=http://username:password@server-ip:port/
Configuring YUM to use proxy
To configure “yum” to use the HTTP / HTTPS proxy, you will need to edit the /etc/yum.conf configuration file.
add the following line:
proxy=http://proxy-server:port
Then clear the cache used by yum:
yum clean all
If your proxy requires authentication, you can configure yum to use proxy authentication by adding/changing the following lines in /etc/sysconfig/rhn/up2date:
enableProxy=1
enableProxyAuth=1
proxyPassword=UserPassword
proxyUser=UserName
httpProxy=http://proxy-server:port