May 16, 2010

Setup proxy setting in a text based linux machine


In generic scenario internet access is running through proxy in small offices in that case Linux command line utilities those require internet access to work like wget, curl, yum and apt-get don't work. The question comes at

How to install packages using proxy by yum?
How to install packages using proxy by apt-get?
How to download file from command line using wget?

All these utilities are depends on shell variables http_proxy and ftp_proxy to work on proxy.

So, to use proxy server to access http/https from a linux machine in CLI, set the environment variable http_proxy. This will allow wget and python’s urllib modules and other applications (yum, apt-get etc) to use this environment variable and access http/https using the settings assigned to the variable http_proxy.

The below would be the ideal way of assigning values for http_proxy variable.
 
$export http_proxy=”http://ipaddress:port

In the same way use ftp_proxy variable to access ftp

$export fttp_proxy=”http://ipaddress:port

Add these two lines to  ~/.bashrc so that this variable exported every time user logs in to machine.

No comments:

Post a Comment