When your server is behind a proxy, you can do the following steps to run apt-get through a proxy:
open the file /etc/apt/apt.conf, if not create it and add the lines
Acquire::http::proxy "http://xxx\username:password@proxy.web.local:/3128";
save and exit. Now everything will go fine.