Wednesday, November 11, 2009

http proxy environment variable

I keep on forgetting this - because it's set and forget. Then you move to new machine, try and run apt or something and...

To use the internets from your shell (lynx,wget, apt or yum from the command-line etc) when located behind a proxy server. Set an env var 'http_proxy' in your profile (.bashrc, .profile etc) - or just set it from a script or command line:

export http_proxy=http://your.proxy.address:proxy-port

if the proxy server wants authentication:

export http_proxy=http://username:password@your.proxy.address:proxy-port
(hmm, password in plain text - make sure your dot files can only be read by self)

My problem is that I tend to forget to add the protocol ('http://') to the above line & then waste some time swearing when it doesn't work. I need to setup more machines, then I'd remember.

No comments: