Use apt-get behind proxy in Ubuntu

This simple and brief tutorial will show you how to use apt-get behind a proxy in Ubuntu.There are 3 ways to do it,pick one you want.

Method 1

sudo gedit /etc/apt/apt.conf

Put below 2 lines to the end of your /etc/apt/apt.conf  :

Acquire::http_Proxy "http://username:password@proxyserver:port/"
 
Acquire::ftp_Proxy "http://username:password@proxyserver:port/"

Method 2

sudo gedit ~/.bashrc

then put below 2 lines to your .bashrc file ,then re-open your teminal

export http_Proxy="http://username:password@proxyserver:port/"
 
export ftp_Proxy="http://username:password@proxyserver:port/"

 

Method 3

Maybe we only need to use apt-get for a short time,then we can just export to enviroments in the command lines.

export http_Proxy="http://username:password@proxyserver:port/"
 
export ftp_Proxy="http://username:password@proxyserver:port/"

Note:You can ignore the “username:passord” if there is no passord of your proxy server

4 thoughts on “Use apt-get behind proxy in Ubuntu

  1. José Manuel

    On method 1 change to:

    Acquire::http_Proxy “http://username:password@proxyserver:port/”;

    Acquire::ftp_Proxy “http://username:password@proxyserver:port/”;

    Reply
  2. Eglefino

    Can somebody tell me what my proxy address is or where to find it? I have searched the whole www about my apt-get proxy error, and everywhere there is the same answers as above, but I cannot find any proxy-adress. Please, let someone give me an example (if nobody will tell me how to use it)
    Apt-get and the Ubuntu Download manager cannot function without a proxy. Maybe someone can tell me, it’s maybe better to re-install my Ubuntu version (Trusty Tahr) to get the proxy working? I never had a proxy myself till I got this apt-get error. Sorry if my English is wrong written, it’s not my own language

    Many thanks for helping.

    ~ I’m open, honest and sincere to myself and to others ~

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *