Proxy and apt-get on Linux

I was trying to get updates to my Linux installation with apt-get but it didn’t work right away
because I was behind a proxy/firewall so I had to tell apt-get to use proxy but how? There is no parameter on apt-get
where you can tell it to use proxy server? So we just have to use environment variables and tell our Linux that http_proxy and https_proxy should use proxy server which will be found on this and that address like this:

For http traffic:

export http_proxy='http://our.secret.proxy:8080'

For https traffic:

export https_proxy='http://our.secret.proxy:8080'

After this all http and https traffic goes through our.secret.proxy and use port 8080 after this apt-get works perfectly.

Bur probably the right way to get apt-get work with proxy is to edit /etc/apt/apt.conf file and add there line:
Acquire::http::Proxy “http://server:port″;
Thank to Anonymous about this one.

2 comments to Proxy and apt-get on Linux

  • Petri

    Thank you. That is actually the right way to add proxy for apt-get so I will add that to my blog post ASAP.

  • Anonymous

    In fact there is a way to operate behind proxy w/o env variables.. Add this to /etc/apt/apt.conf: Acquire::http::Proxy “http://x.x.x:3081”;


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



This site uses Akismet to reduce spam. Learn how your comment data is processed.