How to use apt-get behind proxy server (Ubuntu/Debian)
|
|
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.
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!
Keep updated with the latest posts, be a part of over 1,000 subscribers! :
Subscribe to your email
You might also want to read...
- Setup Free Web Proxy Service with Glype (PHP Script)
- How to find fastest Debian apt-get mirrors with netselect-apt
- AptOnCD: apt-get Repository on DVD/CD – Ubuntu/Debian
- Ubuntu apt-get easter egg trick
- Slashdot.org blocked by US Military
- How to get fastest Ubuntu apt-get repository server with Synaptic
- Ubuntu Feisty Fawn Repository on DVD


February 11th, 2006 at 7:07 am
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
June 21st, 2006 at 6:26 pm
@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.
August 30th, 2007 at 4:54 am
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
February 13th, 2006 at 2:37 am
I think it is advisable to always declare shell environmental variables in all caps.
export HTTP_PROXY=….
export FTP_PROXY=…
Cheers
–arky
February 15th, 2006 at 2:57 am
thanks for the correction Arky :)
February 17th, 2006 at 10:20 pm
[...] [...]
March 1st, 2006 at 2:15 pm
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
April 25th, 2006 at 3:20 am
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.
June 3rd, 2006 at 5:19 pm
[...] 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=………… [...]
September 10th, 2006 at 3:51 am
[...] 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 [...]
September 12th, 2006 at 3:26 am
[...] 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 [...]
September 12th, 2006 at 9:37 am
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.
October 20th, 2006 at 4:09 am
[...] 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 [...]
October 24th, 2006 at 9:01 pm
[...] 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) [...]
November 22nd, 2006 at 11:47 am
What if I want to use proxy for some website and don’t use proxy for some other websites? How to configure that?
November 27th, 2006 at 1:33 am
after editing .bashrc file.I’m still getting the proxy authentication error message.plz get me out of this
December 20th, 2006 at 11:05 pm
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!
January 8th, 2007 at 11:24 pm
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”
January 17th, 2007 at 11:32 am
[...] Source: link [...]
January 19th, 2007 at 4:51 pm
[...] Original post by Kremmen [...]
January 19th, 2007 at 5:06 pm
[...] Original post by Kremmen [...]
January 31st, 2007 at 8:31 pm
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.
February 19th, 2007 at 4:46 am
[...] 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 [...]
February 24th, 2007 at 3:57 am
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).
February 25th, 2007 at 12:08 am
[...] 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 [...]
February 28th, 2007 at 10:29 pm
[...] 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) [...]
March 29th, 2007 at 10:53 am
[...] µÍº: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 [...]
April 26th, 2007 at 12:21 pm
[...] 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. [...]
April 28th, 2007 at 12:46 am
[...] 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, [...]
May 1st, 2007 at 6:55 pm
[...] 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 [...]
June 25th, 2007 at 9:28 pm
[...] A w opcjach apt masz ustawione by korzysta³ z proxy??? info na temat masz np tu http://blog.mypapit.net/2…untudebian.html [...]
July 20th, 2007 at 7:06 pm
[...] 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 [...]
July 26th, 2007 at 8:24 pm
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
October 4th, 2007 at 3:34 am
[...] http://blog.mypapit.net/2006….an.html???? [...]
October 4th, 2007 at 6:50 am
[...] http://blog.mypapit.net/2006….an.html???? [...]
October 7th, 2007 at 7:43 am
[...] Source : http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]
October 8th, 2007 at 9:31 pm
[...] 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 [...]
November 27th, 2007 at 10:13 pm
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…
December 19th, 2007 at 5:19 am
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
February 26th, 2008 at 1:23 pm
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.
March 6th, 2008 at 7:28 am
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.
April 15th, 2008 at 5:28 pm
[...] Source : http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]
June 17th, 2008 at 12:24 pm
[...] 原文出处: http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html [...]
June 17th, 2008 at 6:12 pm
[...] 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. [...]
June 23rd, 2008 at 4:09 am
thanks………….
July 3rd, 2008 at 11:53 pm
Efectivemente, añadiendo a los bashrc las variables en minúsculas y el contenido entrecomillado, funciona perfectamente.
Gracias!!
July 25th, 2008 at 7:39 pm
This worked for me http://ubuntuforums.org/archive/index.php/t-177926.html
September 14th, 2008 at 4:36 am
ÑпаÑибо Ð´Ð»Ñ Ñтого краÑивейшего вебÑайта
September 22nd, 2008 at 3:27 pm
It’s work!
Thanks
November 5th, 2008 at 6:19 pm
[...] 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 [...]
February 24th, 2009 at 1:32 pm
[...] 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 [...]
March 5th, 2009 at 11:10 am
[...] 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 [...]
March 26th, 2009 at 7:43 pm
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 ???
March 26th, 2009 at 8:34 pm
PS: system wide means on the Linux Console + within X of course.
April 7th, 2009 at 11:43 pm
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
April 22nd, 2009 at 7:37 pm
None of the methods listed here worked for me; I keep getting the error: “407 Proxy Authentication Required”. Please help
October 19th, 2009 at 8:53 pm
Thanks, that will be usefull ;-)
November 20th, 2009 at 7:16 pm
[...] apt-get I had to configuring the proxy so it could see outside of the corporate [...]
April 4th, 2010 at 2:43 am
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.
May 29th, 2010 at 2:31 pm
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!
June 7th, 2010 at 6:45 am
[...] 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 [...]
September 30th, 2010 at 4:16 pm
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/”;
October 1st, 2010 at 1:45 pm
Thanks Farid, for your very useful suggestions. indeed, it is more easier to edit the /etc/apt/apt.conf files
October 7th, 2010 at 6:43 pm
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.
November 5th, 2010 at 12:29 pm
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
January 14th, 2011 at 9:03 am
When you drive you’d better not play chicken with cars.
January 18th, 2011 at 2:39 pm
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!
February 23rd, 2011 at 3:49 am
Hope this may help you…
conquer-ur-computer.blogspot.com/2010/12/proxy-settings-in-linux-ubuntu-and.html
May 11th, 2011 at 8:56 am
Awesome blog, thanks for the advice. I will be subscribing to this today, keep up the good work.
July 14th, 2011 at 11:54 am
editing the following file worked for me
/etc/apt/apt.conf
thanks to kosgel
July 20th, 2011 at 2:07 pm
Any time Prakash….
Im glad i was of help
August 8th, 2011 at 11:18 am
ok, thanks very much, it is so important for me, goodluck
August 8th, 2011 at 6:18 pm
Very useful Thank you :)
September 13th, 2011 at 8:51 pm
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
September 26th, 2011 at 3:08 pm
@Prabhakaran
Escape the special character with a \
October 4th, 2011 at 10:26 am
any one can help me to learn about ubuntu server proxy. .. i need your helpment….. chat me on : [email protected]
October 7th, 2011 at 1:14 pm
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..?
October 10th, 2011 at 5:20 pm
I found the solution. We need to use the notation instaed of @ sign . I have used @ and is working.
October 12th, 2011 at 7:39 am
Excellent info on this blog…
I saw this really great post today….