APT proxy connection

In some cases I needed to connect to internet through a proxy.
There are many ways to set the proxy data into browsers or other applications, and sometimes the APT needs an own proxy configuration.

If your APT does not connects to internet and you must use a proxy, you need to execute this command:

# echo "Acquire::http::proxy \"http://username:pwd@proxyIP:port\";" >> /etc/apt/apt.conf

where username and pwd are your username and password used to login into proxy server, proxyIP and port are the IP address and port of your proxy server.

If the file /etc/apt/apt.conf is not already present into system, this command creates the file and writes into it.
If the file is already present, it can have a standard line for proxy settings, that you have to modify with your settings or to delete after the execution of the command.

After that, you can test the connection of APT with:

# apt-get update

and you should have a normal update of the repositories.

Enjoy! 😉

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.