It is quite difficult to use apt-get in ubuntu when you are behind a proxy. To be able to install packages behind a proxy, you need to have a few details:


username: The user name with with you get through the proxy
password: The password with with you get through the proxy
proxyserver: The proxy server
port: The port with with you connect to the proxy server (default is 80)

The proxy can be set in two ways:

Edit your /etc/apt/apt.conf file as root.
Put these line at the end of your /etc/apt/apt.conf file :

Acquire::http::Proxy "http://username:password-AT-proxyserver:port/"

OR

Edit your /etc/bash.bashrc file as root.
Put these line at the end of your /etc/bash.bashrc file :

export http_proxy=http://username:password-AT-proxyserver-DOT-net:port/
export ftp_proxy=http://username:password@proxyserver-DOT-netport/

You can omit the username:password, if your proxy server has no password. That’s all for today! Happy apt-get-ing!
Comments:

You may do it the GUI way too:

Goto System -> Preferences -> Network Proxy & fill in the required details. :)

Posted by Saurabh Aggarwal on September 20, 2008 at 12:44 PM IST #

Nice bit of useful information Avinash. Thanks. :)

Posted by Guruprasad on September 21, 2008 at 02:37 PM IST #

Any similar things for OpenSolaris?

Posted by Guruprasad on September 21, 2008 at 09:20 PM IST #

No Guru Bhai.. Proxy is not yet supported on OpenSolaris..

Posted by Avinash Joshi on September 23, 2008 at 01:27 AM IST #

I just exported a http_proxy variable and it worked in OpenSolaris! :)

Posted by Guruprasad on September 24, 2008 at 05:22 PM IST #

I didn't work for me: URLError, reason: (8, 'node name or service name not known')

Posted by Gomer Gonzalez on February 23, 2009 at 10:08 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Avinash Joshi