How to configure HTTP proxy for apt-get?

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

It seems that apt-get ignores http_proxy , which I defined as follows:

 export http_proxy="http://username: password@host :port/" 
+6
source share
2 answers

I managed to solve it as follows. Go to the following folder:

 cd /etc/apt/apt.conf.d 

Create a file called 10proxy :

 sudo nano 10proxy 

Without authentication, add the following line:

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

Authenticated:

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

/ at the very end was important. It didn't work without him.

+24
source

If you run apt-get with sudo, you need to change /etc/sudoers and add

 Defaults env_keep = "http_proxy https_proxy ftp_proxy" 

you can edit it by calling visudo .

You can also use su , install a proxy, and then run apt-get

+3
source

Source: https://habr.com/ru/post/973856/


All Articles