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

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

  1. there is a lots of confusion proxy env variables. Some say put “export http_proxy=XXX” into /etc/profile , others say put it into /etc/bash.bashrc – now whats right, whats wrong ? Where to put them if you like to have a SYSTEM WIDE configuration ???

  2. Thanks for good article, I just want to share one good web site with really good quality public proxy servers and absolutely FREE.

    It was created especially for professional admins. Proxy updated every 60 sec and each proxy server has such important information as: speed, ping, latency (real and not like most other web sites show), uptime, country and much, much more

  3. None of the methods listed here worked for me; I keep getting the error: “407 Proxy Authentication Required”. Please help

  4. MI BUMMO DIETRO AI PROXY PER NON FARMI QUAHOGGARE DAL SYSADMIN ED ELUDERE GLI ETILOMETRI! MI STRAFACCIO DI ALCOOL PURO E TAVERNELLO! VIVA ME!

    MI APRO!

  5. 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/”;

  6. 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: 10.1.1.30:8080, then type: http_proxy=”http://10.1.1.30:8080″ . (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.

  7. 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.
    Thanks

  8. 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!

  9. 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– http://google.com/
    Resolving 7″@… failed: Name or service not known.
    wget: unable to resolve host address `7″@’

    Help me pls

  10. 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=http://alwin.a:a@123@proxy.inhouse.net:3333/

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

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

  11. The notation that works is URL-encoding.
    So for this it means:
    http_proxy=http://alwin.a:a@123@proxy.inhouse.net:3333/
    http_proxy=http://alwin.a:a%[email protected]:3333/

    /T

  12. 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=""> <strike> <strong>