Hi Im using ubuntu server.
I have set the proxies using :
echo "export http_proxy='http://username:password@proxyIP:port/'" | tee -a ~/.bashrc
I don't know about
apt-get but I've never got yum to work with the environment variables. Instead, I've had to set the proxy via its config.
Here's a related post for the apt-get conf:
Also... how awesome is plain-text passwords sitting in a file that's public-readable by default! (or environment variables and bash history for that matter)