ubuntu set system proxy from command line

Solution 1:

Depending on your needs you could add

   http_proxy="http://your.proxy.here:3128/"
   https_proxy="http://your.proxy.here:3128/"
   ftp_proxy="http://your.proxy.here:3128/"

to /etc/environment to have them set by the login-process.

cheerio

Solution 2:

To proxy updates, add a new file called 01proxy to your /etc/apt/apt.conf.d/ directory with the following line:

Acquire::http::proxy "http://[user]:[password]@[server_ip_or_name]:[port#]";

Substitute the user name/password used to log into the proxy (if required), the server ip or fully-resolved name, and the proxy port # to use when adding this line.