Using apt-get with a proxy server
I recently installed ubuntu on a desktop pc in office. Since i need to access the internet through a proxy, i needed to make sure that apt-get was configured to access the proxy server. After googling aroung for a bit, i came across the configuration for using a proxy server for apt-get.
1) Edit /etc/apt/apt.conf using a text editor.
sudo vi /etc/apt/apt.conf
2) Enter the following text
ACQUIRE {
http::proxy "http://userid:password@proxy-ip:port-number/"
}
If you dont use an user id/password to access the internet, simply use http://proxy-ip:port-number
Then save the file and do the following
sudo apt-get update
Now, we should be all set.. Make sure that you have selected the appropriate repositories to install/
upgrade software
Similarly, we would need to configure the proxy for wget too.
1) sudo gedit /etc/wgetrc
2) In the following lines
# You can set the default proxies for Wget to use for http and ftp.
# They will override the value in the environment.
#http_proxy = http://hostname:portno/
#ftp_proxy =http://hostname:portno/
# If you do not want to use proxy at all, set this to off.
#use_proxy = on
Uncomment the http_proxy and ftp_proxy lines and put the proxy server hostname and ip address there.
Also, make sure to uncomment the use_proxy line.
3) In your .bashrc file (assuming you are using bash shell) set the http_proxy and ftp_proxy variables
export http_proxy = http://hostname:portno/
export ftp_proxy = http://hostname:portno/
Now you should be all set to install updates or new software!


Too easy. As a new linux user it's been doing my head in for days. Thanks :)
Posted by Hamish on September 04, 2009 at 10:10 AM IST #