APT-GET
In case if your access is going through proxy server you need to provide the credentials to APT.
Just create an apt.conf file in /etc/apt/ and add there the following entry :
Acquire::http::Proxy “http://proxyadd:port”;
In case if authentication is needed :
Acquire::http::Proxy “http://username:password@proxyadd:port”;
YUM
/etc/yum.conf
proxy=http://proxyadd:port
proxy_username=user
proxy_password=passwd