You can set HTTP proxies for Apt-get in three ways
Method One
This is a temporary method that you can use if you only temporarily need to use Apt-get through an HTTP proxy.
Before using Apt-get, enter the following commands in the terminal (replace Yourproxyaddress and ProxyPort, depending on your situation).
Export Http_proxy=http://yourproxyaddress:proxyport
Method Two
This method uses the Apt.conf file under the/etc/apt/folder. You can use this method if you want Apt-get (not other applications) to always use the HTTP proxy.
Note: In some cases, the APT profile is not established during system installation. The following actions modify an existing configuration file or create a new profile, as appropriate.
sudo gedit/etc/apt/apt.conf
Add the following line to your apt.conf file (replace yourproxyaddress and ProxyPort, depending on your situation).
Acquire::http::P Roxy "Http://yourproxyaddress:proxyport";
Acquire::ftp::p Roxy "Ftp://127.0.0.1:8000/";
Acquire::https::p Roxy "Https://127.0.0.1:8000/";
Save the apt.conf file.
Method Three
This method adds two lines to the. bashrc file in your home directory. You can use this method if you want apt-get and other applications, such as wget, to use HTTP proxies.
Gedit ~/.BASHRC
Add the following at the end of your. bashrc file (replace yourproxyaddress and ProxyPort, depending on your situation).
Export Http_proxy=http://yourproxyaddress:proxyport
Save the file. Close the current terminal, and then open another terminal.
Test the agent with Apt-get update or any of the network tools you want to use. I use Firestarter to view active network connections.
If you modify the configuration file again to correct the error, remember to close the terminal and reopen it, and the settings will not take effect.
Ubuntu apt proxy settings