Apt-get update: 407 Proxy Authentication Required

My office Internet PCs run Ubuntu. Now and then, I require to install packages on it and I’m behind a proxy server. Below are the methods to configure Proxy settings to apt-get working via the proxy server :

  1. 1. Configure system wide proxy settings
    Go to System Settings –>Network –> Network Proxy. Change the method to Manual and enter the Proxy server IP and port number. But there’s no option to specify the proxy user name and password. So you’ve to edit the /etc/apt/apt.conf file.

    user@linux$ sudo vi /etc/apt/apt.conf
    Acquire::http::proxy "http://username:password@proxyIP:proxyPORT";
    Acquire::https::proxy "https://username:password@proxyIP:proxyPORT";
    Acquire::ftp::proxy "ftp://username:password@proxyIP:proxyPORT";
    Acquire::socks::proxy "socks://username:password@proxyIP:proxyPORT";
  2. Substitute your Proxy username, password and Proxy server’s IP address and its port.

  3. 2. Set the environment variable HTTP_PROXY
    user@linux$ export HTTP_PROXY=http://username:password@proxyIP:proxyPORT

    To make the changes permanent, append the .bashrc or .profile file with the above command. Verify the setting by running,

user@linux$ echo $HTTP_PROXY

Any special characters such as $,!,*,^ etc in the password have to be prefixed with a back slash “\” to prevent BASH from interpreting as meta characters. For example, if the proxy password is “s3cr!t”, HTTP_PROXY environment variable should be set from as terminal as

sudo export HTTP_PROXY=http://deepakd:s3cr\!t@

Where is the proxy server and 3128 is the port on which it’s listening.

For more methods refer this askubuntu page.

About Deepak Devanand

Seeker of knowledge
This entry was posted in Linux. Bookmark the permalink.

One Response to Apt-get update: 407 Proxy Authentication Required

  1. Pingback: Downloading 64-bit packages in a 32-bit Ubuntu system | Deepak's Kaleidoscope

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s