Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got an Ubuntu 11.10 system connected via a proxy to the internet, and I would like to install packages via apt-get. When I try to do that I get this error message:

sudo apt-get install libboost-program-options-dev
[...]
Err http://gb.archive.ubuntu.com/ubuntu/ oneiric/main libboost1.46-dev i386 1.46.1-5ubuntu2
407  Proxy Authentication Required

Any ideas?

share|improve this question
is their any free proxy details available so that i can connect and download some packages @ my office. – Jaison Justus Oct 16 '12 at 4:50

4 Answers

up vote 16 down vote accepted

This method worked for me.....just have a try...

check the file /etc/apt/apt.conf

The contents were,

Acquire::http::proxy "http://<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<proxy>:<port>/";
Acquire::https::proxy "https://<proxy>:<port>/";

This was the reason why you could reach proxy but couldn't get past it, since there is no username password information. So just put that info into it..

Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/";
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";

save the file and you are done...


BROTIP: More better add these lines in another file, /etc/apt/apt.conf.d/80proxy. This will ensure that after a version upgrade changes won't be lost.

share|improve this answer
Great! This did the trick. Thanks! – 213441265152351 Dec 22 '11 at 16:14
pleasure....... – Vineet Menon Dec 23 '11 at 9:05
more better if you create a file /etc/apt/apt.conf.d/80proxy and you copy there these lines. Because whenever apt.conf gets a package upgrade, you must re-add the lines. – gajdipajti Mar 15 '12 at 7:36
1  
@gajdipajti: I'll incorporate these edits in answer.. – Vineet Menon Mar 15 '12 at 10:25

To configure a proxy temporary, set the http_proxy environment variable. If the proxy is proxy.example.com on port 8080 and you need to authenticate with username user and password pass, run:

sudo http_proxy='http://user:pass@proxy.example.com:8080/' apt-get install package-name

To set such a proxy permanently, create /etc/apt/apt.conf.d/30proxy containing:

Acquire::http::Proxy "http://user:pass@proxy.example.com:8080/";

The changes are immediately visible the next time you run apt.

share|improve this answer
1  
It's still not working, same error. I should mention I have my proxy set up globally on Applications -> System Tools -> System Settings -> Network Proxy -> Apply system Wide – 213441265152351 Dec 21 '11 at 14:44
The proxy connection works for me (tested with netcat as well as Squid). What proxy server is in use? Some proxies may need other authentication methods. – Lekensteyn Dec 21 '11 at 17:34
+1 temporary workaround was a more suitable answer for me! – wim Nov 21 '12 at 4:56

An alternative is to use Synaptics Package Manager, setting in its Preferences the proxy to which you want to connect. You can find the configuration using this path: Settings -> Preferences -> Network

share|improve this answer

Problems with most of the methods I have seen is that you leave your password in readable text file. Moreover imagine the situation; you have two accounts on the computer; one to be used for work purposes (connecting to the office via vpn and requiring proxy to access internet sources) and another one for 'home' use.

The only thing that would perhaps work based on the user account is the edit of .bashrc - but then you're leaving your password and username in a text file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.