Saturday, November 5, 2011

using apt-get behind a proxy server ...

Although synaptics provides a easy way to configure a network all you need to do is goto settings-->preferences-->network, this works good for newbees and if actually don't know what you are searching for and also is inevitable if the number of individual packages is large. Well i prefer it doing through terminal with apt-get but the problem is if you are on a college network which allows you to access internet through an intermediate proxy server then you'll find that the usual 
sudo apt-get install abc
won't be able to fetch the required packages ...
so here comes the solution ... all thats required is you create a file apt.conf in /etc/apt/ and add the following lines to it ...

Acquire::http::proxy "http://proxyserver:port/";
Acquire::ftp::proxy "ftp://proxyserver:port/";
Acquire::https::proxy "https://proxyserver:port/";

here are the complete steps ... 
  • open the terminal 
  • sudo gedit /etc/apt/apt.conf
  • now add these lines here the proxyserver is at 10.1.1.4 and uses port 8080 ...
Acquire::http::proxy "http://10.1.1.4:8080/";
Acquire::ftp::proxy "ftp://10.1.1.4:8080/";
Acquire::https::proxy "https://10.1.1.4:8080/";

  • and if are assigned a username and password use the following syntax ...
Acquire::http::proxy "http://username:password@proxyserver:port/";
Acquire::ftp::proxy "ftp://username:password@proxyserver:port/";
Acquire::https::proxy "https://username:password@proxyserver:port/";

  • let username is abc and password is 123 ... then u'll enter ...
Acquire::http::proxy "http://abc:123@10.1.1.4:8080/";
Acquire::ftp::proxy "ftp://abc:123@10.1.1.4:8080/";
Acquire::https::proxy "https://abc:123@10.1.1.4:8080/";

thats all use apt-get the way u used to be ... enjoy !!!