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

advertisement logo

 

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


Share this post

Keep updated with the latest posts, be a part of over 1,000 subscribers! : email iconSubscribe to your email

79 smashing comments for this post.

  1. Blog Portal @ Blogtal.com Said:

    How to use apt-get behind proxy server (Ubuntu/Deb… Feb 11, 2006 1:03 AM – Mypapit’s blog @ Computers If you are one of Debian-based GNU/Linux distro users, then you must have been familiar with synaptic and apt-get to install application from software

  2. mario carri?n Said:

    @proxyaddress:port/ echo -e \nProxy environment variable set. } Don?t forget to change: proxyaddress:port. With this everything should work. Want to know more? There are two references I read: 1,2.

  3. Viper2110 Said:

    http://username:[email protected]:port” But I appended them to the file /etc/profile instead of /etc/bash.bashrc so that it would effect synaptic from the menus (and lots of other system programs). Source :http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html

  4. Arky Said:

    I think it is advisable to always declare shell environmental variables in all caps.

    export HTTP_PROXY=….
    export FTP_PROXY=…

    Cheers

    –arky

  5. mypapit (Admin) Said:

    thanks for the correction Arky :)

  6. synaptic package manager proxy - Google Search Said:

    [...] [...]

  7. Bill Chivers Said:

    Hello all,

    The problem with the solutions above is that a password is stored in a text file or in the Synaptic configuration. This is not acceptable to the IT staff where I work and really is the only reason I do not use Debian or Ubuntu at work.

    Is there a more secure solution, perhaps a way to get a secure dialog box which asks for proxy username and password each time Synaptic is used? Similar to the web browser?

    Thanks,
    Bill Chivers

  8. Alan Pope Said:

    Yeah, Bill if you want to use apt without storing a password you can do this:-

    Add the following to /etc/bash.bashrc

    function proxy(){
    echo -n “username:”
    read -e username
    echo -n “password:”
    read -es password
    export http_proxy=”http://$username:$password@proxyserver:8080/”
    export ftp_proxy=”http://$username:$password@proxyserver:8080/”
    echo -e “\nProxy environment variable set.”
    }

    Then whenever you want to set the proxy variable you just type “proxy” at the command line. When prompted for your proxyserver user name you type it in (you may need to type domain\\user if it’s a domain account) and then when prompted type your password (which isn’t echoed to the screen).

    This will then set the environment variables, and they’ll be lost when you exit your session.

    Cheers,
    Al.

  9. Software Libre :: Ver tema - apt-get por un proxy Said:

    [...] Hola, esto no lo he probado aun, pero lo pongo por si acaso y espero comentarios: How to use apt-get behind proxy server (Ubuntu/Debian)———- 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! —————- Tomado de http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html ESTE SI http://www.debian-administration.org/articles/177 ———– TAMPOCO!!!!!!!!!!! lo ?nico que me ha medio servido es lo de export hhtp_proxy=………… [...]

  10. aptget not updating packages-Ubuntu Help-Linux Forums Said:

    [...] Perhaps this is what you are looking for : http://blog.mypapit.net/2006/02/how-…ntudebian.html __________________ "To express yourself in freedom, you must die to everything of yesterday. From the ‘old’, you derive security; from the ‘new’, you gain the flow." -Bruce Lee [...]

  11. aptget not updating packages - Ubuntu Forums Said:

    [...] Re: aptget not updating packages the method of getting updates behind the proxies is given in this urlhttp://blog.mypapit.net/2006/02/how-…ntudebian.html [...]

  12. snoopy Said:

    I have a password that ends with the character @ , how do get around the fact that there are 2 @@ in one line and prevent the failure of auth because of this.

  13. Hardware Upgrade Forum - aiuto apt-get Said:

    [...] 22-02-2006 18:33 Prova a vedere qui: http://www.opensubscriber.com/messa…org/246055.html e soprattutto: http://blog.mypapit.net/2006/02/how…untudebian.html [...]

  14. apt-get behind proxy server - Ubuntu Forums Said:

    [...] Re: apt-get behind proxy server You may have found this by now, but since I came across your question while searching for the answer, this worked for me: http://blog.mypapit.net/2006/02/how-…ntudebian.html Note that I chose to change the .bashrc in my homedir rather than in etc, which would be a systemwide change… __________________ running Ubuntu for AMD64 on HP Compaq nx6125 PY416EA (Turion64 ML-34, Radeon Xpress 200M) [...]

  15. antok Said:

    What if I want to use proxy for some website and don’t use proxy for some other websites? How to configure that?

  16. atul Said:

    after editing .bashrc file.I’m still getting the proxy authentication error message.plz get me out of this

  17. Darius Said:

    You do not need to search for working free web proxies. All is here.
    Find free web proxy for desired country!
    All proxies are regulary checked if they still alive.

    http://getproxy.emigrantas.com

    enjoy it!

  18. Dan Said:

    Hi,
    I had the same problem and the export worked for me, but with quotes:
    export http_proxy=”http://username:[email protected]:port”
    export ftp_proxy=”http://username:[email protected]:port”

  19. How to run apt-get behind a proxy? « Dave’s Blogs Said:

    [...] Source: link [...]

  20. Planeta Ubuntu » How to use apt-get behind proxy server (Ubuntu/Debian) : mypapit gnu/linux blog Said:

    [...] Original post by Kremmen [...]

  21. Planeta Debian » How to use apt-get behind proxy server (Ubuntu/Debian) : mypapit gnu/linux blog Said:

    [...] Original post by Kremmen [...]

  22. Arch Said:

    You can’t use the variable in uppercase (HTTP_PROXY) you have to use lowercase.
    The CLI tools do not recognize the uppercase environment var.

  23. AdBrite - Advertise on Free Software and Open Source Tips Said:

    [...] http://blog.mypapit.net/…sia-tak-bogel-tapi-lucah.htmlhttp://blog.mypapit.net/…roxy-server-ubuntudebian.htmlhttp://blog.mypapit.net/…-cds-becareful-with-them.htmlhttp://blog.mypapit.net/…-advantage-tattoo-cracks.htmlhttp://blog.mypapit.net/…eo-files-to-avi-in-linux.htmlhttp://blog.mypapit.net/…now-available-on-windows.html [...]

  24. Ross Said:

    The lower-case export lines with quotes worked for me:
    export http_proxy=”http://username:[email protected]:port”
    export ftp_proxy=”http://username:[email protected]:port”
    But I appended them to the file /etc/profile instead of /etc/bash.bashrc so that it would effect synaptic from the menus (and lots of other system programs).

  25. Debian And Ubuntu GNU/Linux News,Tutorials: How to use apt-get behind proxy server (Ubuntu/Debian) Said:

    [...] If 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.Full Story [...]

  26. Un nuovo chiede aiuto Said:

    [...] prova la 8080.e prova a leggere questo. attento a quando parla delle variabili d'ambiente, che vanno in maiuscolo (HTTP_PROXY e FTP_PROXY) [...]

  27. Ubuntuclub - µÍº:apt-get ·ÐÅØ proxy äÁèä´é¤ÃѺ - Ubuntu Club. Said:

    [...] µÍº:apt-get ·ÐÅØ proxy äÁèä´é¤ÃѺ – 13/12/2006 01:53 ÁÕ 2 ÇÔ¸Õ¤ÃѺ ·´Åͧ´Ù¹Ð¤ÃѺ1. ¶éÒãªé¼èÒ¹ SynapticãËéàÃÕ¡â»Ãá¡ÃÁ Synaptic áÅéÇä»·Õè Settings-> Preference -> Network áÅéÇ¡çãÊè proxy2. ¶éÒãªé¼èÒ¹ command-line apt-getãËéà¢éÒãªé§Ò¹à»ç¹ root ¡è͹ áÅéÇá¡éä¢ä¿Åì /etc/bash.bashrc áÅéÇàµÔÁ¢éͤÇÒÁµèÍ仹Õéà¾ÔèÁàµÔÁexport http_proxy=http://[email protected]/export ftp_proxy=http://[email protected]/áÅéÇá¡éä¢ÃËÑʼèÒ¹áÅÐ proxy ãËéà»ç¹¢Í§¤Ø³¤ÃѺ´ÙÍéÒ§ÍÔ§à¾ÔèÁàµÔÁ¤ÃѺhttp://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  28. 2006 October « Harsh but fair Said:

    [...] There are a few posts on the web about how to do this some, saying you just need to set the environment variable http_proxy, others that you must specify the proxy settings in the file /etc/apt/apt.conf.d/70debconf . For my Kubuntu install I found a mixture of the two was required, more of which anon. [...]

  29. Foros de Ubuntu-cl :: Ver tema - Ubuntu en Proxy WIndows Said:

    [...] So Sorry, En realidad no fue cut and paste, lo leí en… http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html y de ahí preparé la respuesta, Saludos, [...]

  30. apt get zeigt nur Pakete von der CD, nicht aus dem Netz - Unixboard.de Said:

    [...] Heute, 11:55 http://blog.mypapit.net/2006/02/how-…ntudebian.html da steht drin wie du den proxy einrichten kannst, dann apt-get update und dann viel spass! GEGEN TCPA [...]

  31. UBUNTU.PL :: Zobacz temat - [SOLVED] apt-get przekroczony czas po³±czenia Said:

    [...] A w opcjach apt masz ustawione by korzysta³ z proxy??? info na temat masz np tu http://blog.mypapit.net/2…untudebian.html [...]

  32. gnome terminal behind proxy !! Said:

    [...] Thank you all for replying .I used this solution and it worked :QuoteEdit 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]/I found it here:http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.htmlMany thanks [...]

  33. gavu Said:

    i wonder… i read ALL your comments… but it did not work… they are all great… but they will not work if u have another set of IP Addresses on your laptop… other then the ones used in the network you are in…

    sometimes… i wonder hoe stupid i can be :D

    THANKS FOR ALL THE HELP… great blog

  34. iB::????::Apt-get ???? ccproxy Said:

    [...] http://blog.mypapit.net/2006….an.html???? [...]

  35. iB::????::Apt-get ???? ccproxy Said:

    [...] http://blog.mypapit.net/2006….an.html???? [...]

  36. viper2110 » Blog Archive » How to use apt-get behind proxy server (Ubuntu/Debian) Said:

    [...] Source : http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  37. Aktualizace po instalaci [vy?ešeno] Said:

    [...] Nem?žeš to stáhnout protože se p?ipojuješ p?es Proxy která je bu? špatn? nastavená nebo ji máš špatn? nastavenou.Zkus mrknout na: http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  38. Fax Said:

    On Debian this is not working at all.
    No way to pass username and password correctly to apt.

    I’ve done everything, and i got ubuntu woking well many months ago.

    But debian… no way…

  39. sharma Said:

    sir
    i dont know how to use proxy server, in internet explore i can set for proxy i.paddress and port but not working.
    another problem is that
    i can use same time , i.e mozila without proxy server, but with internet explore with proxy server

    plz reply me, this is , my first time question

    thanks

    sharma

  40. Bob Said:

    Set the http_proxy environment variable, but most importantly, open Synaptics Package Manager, go to Settings->Preferences. Then click on the Network Tab. Enter your proxy information there and you’ll be rolling immediately.

  41. de2our Said:

    Under gnome/ubuntu v7.04, I don’t have synaptics package manager or a settings/preferences/gnome path.

    Instead, appended the 2 exports (lowercase) to /etc/bash.bashrc and put my proxy info into the dialog box on System/Preferences/Network Proxy.

  42. -=www.21v10.za.net=- » How to use apt-get behind proxy server (Ubuntu/Debian) Said:

    [...] Source : http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  43. Ricky’s Blog » 如何在配置了代理服务器的机子(Ubuntu/Debian)上使用apt-get Said:

    [...] 原文出处: http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  44. Ubuntu Server 8.04 - EduGeek.net Forums Said:

    [...] assume your using a non-transparent proxy which you haven’t configured Ubuntu to use. See: How to use apt-get behind proxy server (Ubuntu/Debian) : mypapit gnu/linux blog How to apt-get behind a proxy? – Ubuntu Forums apt-get thru proxy – Ubuntu Forums Hope that helps. [...]

  45. emmanuel darko Said:

    thanks………….

  46. Tito Pelon Said:

    Efectivemente, añadiendo a los bashrc las variables en minúsculas y el contenido entrecomillado, funciona perfectamente.
    Gracias!!

  47. nogg3r5 Said:

    This worked for me http://ubuntuforums.org/archive/index.php/t-177926.html

  48. londra Said:

    спасибо для этого красивейшего вебсайта

  49. hvtuananh Said:

    It’s work!
    Thanks

  50. hafidz.nasruddin · Masalah dengan proxy pejabat diatasi Said:

    [...] ke server repo. Mula mencari-cari cara untuk melepasi proxy di pejabat ini dan terjumpa entry mypapit. Malangnya cara yang ditunjukkan tidak berjaya untuk melepasi proxy di pejabat. Setelah [...]

  51. Run apt-get behind proxy server - Ubuntu 8.04 LTS Server « Antoniusvito’s Blog Said:

    [...] Ubuntu Forum http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html Possibly related posts: (automatically generated)How to use apt-get behind proxy server [...]

  52. APT-GET behind PROXY on Ubuntu « + antonius vito triantori + Said:

    [...] How to use apt-get behind proxy server (Ubuntu/Debian) http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]

  53. Axel Werner Said:

    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 ???

  54. Axel Werner Said:

    PS: system wide means on the Linux Console + within X of course.

  55. Owner of Free Proxy List Said:

    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

  56. Shrik Said:

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

  57. Jean-Charles Riquet Said:

    Thanks, that will be usefull ;-)

  58. Building a high performance cluster with Ubuntu 9.10 and Eucalyptus | Entrepreneurial Geekiness Said:

    [...] apt-get I had to configuring the proxy so it could see outside of the corporate [...]

  59. Arline Pennel Said:

    Hello The best proxy lists on the web which are really working I found after a long search are here Buy Proxy Lists You might want to try it out. It took me a long time to find finally high quality proxy lists.

  60. PUCCIO Said:

    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!

  61. Configurar proxy en Debian para usar aptitude - linux - REGOREMOR Said:

    [...] http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html tweetmeme_url = 'http://www.regoremor.com/linux/configurar-proxy-en-debian-para-usar-aptitude/';tweetmeme_source = 'regoremor';tweetmeme_style = 'compact'; Etiquetas: apt, aptitude, debian, linux, proxy Comentario (RSS)  |  Trackback [...]

  62. Farid Said:

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

  63. mypapit (Admin) Said:

    Thanks Farid, for your very useful suggestions. indeed, it is more easier to edit the /etc/apt/apt.conf files

  64. arkady Said:

    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.

  65. Shailendra Said:

    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

  66. coach factory store Said:

    When you drive you’d better not play chicken with cars.

  67. kosgei Said:

    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!

  68. SANJEEV Said:

    Hope this may help you…

    conquer-ur-computer.blogspot.com/2010/12/proxy-settings-in-linux-ubuntu-and.html

  69. Morton Barr Said:

    Awesome blog, thanks for the advice. I will be subscribing to this today, keep up the good work.

  70. Prakash Said:

    editing the following file worked for me

    /etc/apt/apt.conf

    thanks to kosgel

  71. Kosgei Said:

    Any time Prakash….
    Im glad i was of help

  72. hendri Said:

    ok, thanks very much, it is so important for me, goodluck

  73. Sethathi Said:

    Very useful Thank you :)

  74. Prabhakaran Said:

    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

  75. poseidon Said:

    @Prabhakaran
    Escape the special character with a \

  76. hendri Said:

    any one can help me to learn about ubuntu server proxy. .. i need your helpment….. chat me on : [email protected]

  77. Alwin Said:

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

  78. Alwin Said:

    I found the solution. We need to use the notation instaed of @ sign . I have used @ and is working.

  79. MyBlog Said:

    Excellent info on this blog…

    I saw this really great post today….

Leave a Comment

Subscribe by email

Enter your Email