'apt-get' does not work with Proxy
For the command
sudo apt-get update
I get following error:
W: Failed to fetch http://ch.archive.ubuntu.com/ubuntu/dists/maverick-updates/multiverse/binary-i386/Packages.gz
407 Proxy Authentication Required (The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )
I am running Ubuntu 10.10 installed on Windows XP using VirtualBox. For Internet connections I am using proxy server with an authentication. I tried to use gnome-network-proxy
tool to set proxy settings system-wide.
After that /etc/environment
has been updated by http_proxy
variable with the format http://my_proxy:port/
, there were no authentication data.
I checked this with Firefox. Browser asked my for login and password and everything was working fine. It was unfortunately not the case for apt-get. I have also tried to do as described here. Unfortunately it does not work.
May it be somehow related to the fact that a proxy is in a Windows domain, any ideas?
My proxy name is http-proxy. Is '-' a special character here?
Solution 1:
For my corporate network I was given by my administrator the proxy name in the format:
http://[username]:[password]@[proxy-webaddress]:[port]
For our Windows network our username is in the format:
[domain]\[username]
For example:
http://mywindowsdomain\fossfreedom:[email protected]:8080
This was added to the following NEW file (it doesnt exist by default):
gksudo gedit /etc/apt/apt.conf.d/01proxy
The following text was added:
Acquire::http::Proxy "http://mywindowsdomain\fossfreedom:[email protected]:8080";
If you are using an anonymous proxy then you don't need your login credentials:
Acquire::http::Proxy "http://askubuntu-proxy.com:8080";
Save the file and then checked that all was ok with:
sudo apt-get update
Solution 2:
I have found that USERNAME and PASSWORD entered into the "Network Proxy" applet does not get stored into the apt.conf file you must manually add the username and password in the /etc/apt/apt.conf file.
The "Network Proxy" applet only stores the hostname and the port.
The basic syntax is
Acquire::http::proxy "http://User:Password@host:port/";
Acquire::ftp::proxy "ftp://User:Password@host:port/";
Acquire::https::proxy "https://User:Password@host:port/";
If you are using Windows usernames and password follow this advice:
User = Domain/Username
(windows users use /
not \
)
If you are using Windows strong/complex password with special characters you must use the URL encoding for the values, for example an "@" in the password would be "%40".