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: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!
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%40123@proxy.inhouse.net:3333/
/T
I found the solution. We need to use the notation instaed of @ sign . I have used @ and is working.
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 ‘123@proxy.inhouse.net’
How can I fix this other than changing the password..?
@Prabhakaran
Escape the special character with a \
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
Very useful Thank you :)
ok, thanks very much, it is so important for me, goodluck
Any time Prakash….
Im glad i was of help
editing the following file worked for me
/etc/apt/apt.conf
thanks to kosgel
Awesome blog, thanks for the advice. I will be subscribing to this today, keep up the good work.
Hope this may help you…
conquer-ur-computer.blogspot.com/2010/12/proxy-settings-in-linux-ubuntu-and.html
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!
When you drive you’d better not play chicken with cars.
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
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.
Thanks Farid, for your very useful suggestions. indeed, it is more easier to edit the /etc/apt/apt.conf files
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/”;
None of the methods listed here worked for me; I keep getting the error: “407 Proxy Authentication Required”. Please help
PS: system wide means on the Linux Console + within X of course.
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 ???
It’s work!
Thanks
This worked for me http://ubuntuforums.org/archive/index.php/t-177926.html
thanks………….
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.
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.
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
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…
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
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).
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.
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”
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!
after editing .bashrc file.I’m still getting the proxy authentication error message.plz get me out of this
What if I want to use proxy for some website and don’t use proxy for some other websites? How to configure that?
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.
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.
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
thanks for the correction Arky :)
I think it is advisable to always declare shell environmental variables in all caps.
export HTTP_PROXY=….
export FTP_PROXY=…
Cheers
–arky