In Ubuntu, we used to install packages with apt-get utility. So apt-get utility should reach to internet in order to install packages in Ubuntu machine from various ubuntu.com repositories.

When our Linux/ubuntu machine have direct internet connection, this would be quite easy to connect ubuntu.com and download and install packages. But sometime our machines are behind proxy and in those scenario we have to use apt-get to fetch packages from proxy itself. So in this post, we will try to see how can we download and install packages from apt-get in ubuntu, when machine is behind proxy

For this, we have to add one line in /etc/apt/apt.conf. Basically this file contain various apt-get configuration, that we want to use during apt-get command.

root@srv21:~# cat /etc/apt/apt.conf
Acquire::http::Proxy http://www-proxy.example.com:80;

In above box, we can see we used to mention network proxy in /etc/apt/apt.conf, so you have to mention your network proxy in /etc/apt/apt.conf as mentioned above. After adding this, we can able to use apt-get command to download and install packages in ubuntu machine behind proxy