How to use apt-get behind proxy server (Ubuntu/Debian)

mypapit debianIf you are a Debian-based GNU/Linux user, then you’re probably familiar with synaptic and apt-get to install application from software repositories. This post focussed on how to use apt-get/synaptic behind proxy server/firewall which under normal circumstances, you’re unable to use apt-get.

If you’re using Synaptic

Open up your Synaptic package manager (usually as root), go to Settings-> Preference -> Network. Enter your proxy server details like : username:[email protected], and put the proxy server port (usually 8080).

If you’re using command-line apt-get

Edit your /etc/bash.bashrc file as root.

Put these line at the end of your /etc/bash.bashrc file :

export http_proxy=http://username:[email protected]:port/
export ftp_proxy=http://username:[email protected]/

You can omit the username:password, if your proxy server has no password. That’s all for today! Happy apt-get-ing!

debian,ubuntu,knoppix, mepis, apt-get

80 thoughts on “How to use apt-get behind proxy server (Ubuntu/Debian)

  • just set them in /etc/apt/apt.conf

    like this:

    Acquire::http::proxy “http://user:pass@ip:port/”;
    Acquire::https::proxy “https://user:pass@ip:port/”;
    Acquire::ftp::proxy “ftp://user:pass@ip:port/”;

  • I’ve seen this problem sometimes cropping up! One of the reasons this problem can occur is when your http_proxy variable is not set properly!
    The $http_proxy variable in your terminal overrides the http::proxy variable in /etc/apt/conf file and the connection is not established if the http_proxy variable in the terminal is set to [proxy]:[port] instead of http://proxy:port. To check this out do the following:
    Type: echo $http_proxy in the terminal
    If it is something like this:, then type: http_proxy=”″ . (we’re just adding the ‘http://’ before the content of the variable)
    If the problem was because of the overriding variables, it’d be solved by now .. try typing sudo apt-get update and see if it works.

  • I tried farid’s method and i am getting followinf error:
    Syntax error /etc/apt/apt.conf:4: Extra junk at end of file
    please help me out.I am a newbie and installed ubuntu 10.10 tomorrow only.

  • shailendra….try this,it sure should work..

    gedit /etc/apt/apt.conf

    then add these two lines

    Acquire::http::Proxy “http://username:password@proxy ip adress:8080/”;

    Acquire::ftp::Proxy “http://username:password@proxy ip adress:8080/”;

    where you input the following
    username = name of your wireless connection
    password = password of the wireless connection
    proxy ip address = ip address of your proxy server
    8080 = its the default proxy port,DONT CHANGE THAT!

  • Hii,

    My password have a special character.
    I have faced this problem.

    used this format [prabhakaran:1123@7@:80]

    –2011-09-13 18:18:41–
    Resolving 7″@… failed: Name or service not known.
    wget: unable to resolve host address `7″@’

    Help me pls

  • Hi,

    I have some problem with the password. My password already have ‘@’ character. So whenever I try to do an ap-get update after exporting the proxy it is showing the character after the @ symbol. For eg : I am giving export http_proxy=

    and during the update process it is returning Could not resolve ‘[email protected]

    How can I fix this other than changing the password..?

  • The notation that works is URL-encoding.
    So for this it means:
    http_proxy=http://alwin.a:a%[email protected]:3333/


  • This type of trait makes it possible for someone to create almost any dialogue call up through deciding on individuals from the Associates as well as tapping Telephone Currently! Relating to the very first time inside the 30 a very extensive period connected with songs conferencing, any kind of talk call up can be initiated devoid of wanting to transfer Pins and also dial-in quantities; the particular consumers are referred to as exclusively. In particular, the enthusiasts are generally meeting higher than a weekend break with an significant starting as well as also have to get review the ultra-modern breezes correct now-there‚Äôs little time to routine a regular new music conversation.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>