You might need a username and password if the proxy is not anonymous. Here is how to connect to both types of proxies for using apt-get. Remember sudo if you uses Ubuntu.
First a new file is needed in the directory /etc/apt/apt.conf.d/
vim /etc/apt/apt.conf.d/01proxy
Modify this text to your own settings (authenticated proxy).
Acquire::http::Proxy “http://username:password@ip_or_hostname:port”
For and anonymous proxy you skip the username and password
Acquire::http::Proxy “http://ip_or_hostname:port”;
Then run:
apt-get update
You are now connected!