How to set proxy in terminal

Setting proxy in terminal is very straight forward. Use export command to set it.

export http_proxy=http://proxyip:proxyport

Replace proxyip with the ip of the proxy and proxyport with the port of proxy.
In case your proxy requires authentication, use

export http_proxy=http://username:password@proxyip:proxyport

For example, the command becomes (in my university)

export http_proxy=http://282421:pass@10.1.1.19:80

You need to enter this command in each terminal you open or you can enter this in ~/.bashrc.
After setting proxy in the terminal, you may now use wget or apt-get/yum without getting error Connection refused.

You may be wondering, why I am posting only on proxy. The only reason is i got struck on proxy settings on my first installation of linux and removed it. It took a long time when i started using linux again. Also, i am behind a proxy server in my college and aim to provide simple articles for beginners.

~ by atulaggarwal on April 28, 2009.

Leave a Reply