apt-get not getting proxy authentication

Asked by Bindu Sunil

The first time I used Ubuntu, I had installed 8.04 (Hardy version)
and in this after I did export http_proxy=http://username:<email address hidden>:port (As I'm behind a firewall),
I was able to download anything using apt-get.

But, then, after I moved to Ubuntu 10.04 and now 10.10, I'm unable to use apt-get.
The only way I can install anything in 10.04v and in 10.10 is using Synaptic manager.
The command apt-get update tries to run and gives the error
Failed to fetch <repository url> 407 Proxy authentication required.

I have set the proxy correctly in System->Prefernecs->Network proxy and have pplied it system wide.
I have also entered the proxy settings in synaptic manager.
Mozilla browser opens and I'm able to browse the net too.

Only on command line, apt-get does not work even inspite of exporting the http_proxy variable.
I went through many solutions on the web and tried many things like adding the export http_proxy=....
in different files such as /etc/profiles.d/xxx.sh file in /etc/bash.bashrc and /home/binunun/.bashrc etc..
Nothing has worked so far on both 10.04 as well as 10.10

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu software-center Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

also run:

ftp_proxy=http://username:<email address hidden>:port

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#2

you may also need to run:

gksudo gedit /etc/apt/apt.conf

add these 2 lines:

Acquire::http::Proxy "http://username:<email address hidden>:port";
Acquire::ftp::Proxy "http://username:<email address hidden>:port";

Save the new file then run:

sudo apt-get update

The 2nd line I added myself so may not be needed but if it works with then leaveit in :)

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#3

I use another method:

gksudo /etc/apt/apt.conf.d/proxy

add this row:

Acquire::http::proxy "http://proxy_user:proxy_password@proxy_server:proxy_port/";

Save and exit

use it

Revision history for this message
Bindu Sunil (bindu-sunilj) said :
#4

Thanks actionparsnip, that solved my question.

Revision history for this message
Richdel (richdel1991) said :
#5

Thanks marcobra, this works for me!