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:password@proxyserver.net, 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:password@proxyserver.net:port/
export ftp_proxy=http://username:password@proxyserver.netport/

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

Bookmark this article
  • digg
  • YahooMyWeb
  • NewsVine
  • Netvouz
  • Reddit
  • Spurl
  • Furl
  • del.icio.us
  • StumbleUpon
  • Technorati
  • TwitThis

Keep updated with this website! : Subscribe to your email

Recommended Reading

56 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:password@proxyserver.net: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 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:password@proxyserver.net:port/ export ftp_proxy=http://username:password@proxyserver.netport/ 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:password@proxyserver.net:port”
    export ftp_proxy=”http://username:password@proxyserver.net: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:password@proxyserver.net:port”
    export ftp_proxy=”http://username:password@proxyserver.net: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://usernameassword@proxyserver.netort/export ftp_proxy=http://usernameassword@proxyserver.netport/áÅéÇá¡éä¢ÃËÑʼèÒ¹áÅÐ 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:password@proxyserver.net:port/export ftp_proxy=http://username:password@proxyserver.netport/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

Leave a Comment

Subscribe by email

Enter your Email