How can i configure a http proxy for apt-get?

S.Spieker picture S.Spieker · Aug 15, 2014 · Viewed 35.4k times · Source

I have a raspberry pi with raspbian. I have to use a http proxy now, but where can I configure the proxy?

It seems the apt-get ignores the http_proxy, which I defined like this:

export http_proxy="http://username:password@host:port/"

Answer

S.Spieker picture S.Spieker · Aug 15, 2014

I managed to solve it in the following way. Go to the following folder:

cd /etc/apt/apt.conf.d

Create a file named 10proxy:

sudo nano 10proxy

Without authentication add the following line:

Acquire::http::Proxy "http://yourproxyaddress:proxyport/";

With authentication:

Acquire::http::Proxy "http://username:password@yourproxyaddress:proxyport/";

The /at the very end was important. Without it it did not work.