Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/"
like image 489
S.Spieker Avatar asked Aug 15 '14 06:08

S.Spieker


2 Answers

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.

like image 177
S.Spieker Avatar answered Oct 02 '22 15:10

S.Spieker


If you run apt-get with sudo you have to modify /etc/sudoers and append

Defaults env_keep = "http_proxy https_proxy ftp_proxy"

you can edit it by calling visudo.

You could also use su, set the proxy and then run apt-get

like image 21
Trudbert Avatar answered Oct 02 '22 17:10

Trudbert