How do I set system wide proxy in Ubuntu 18.04?

There is no 'Apply System Wide' option.I have to manually change /etc/apt/apt.conf file every time I set or unset proxy.

How do I configure it so that it applies system wide proxy settings - with apt.conf updating accordingly in Ubuntu 18.04?

EDIT:

Despite setting apt.conf manually, I'm not able to install anything through Ubuntu Software because an "Unsupported proxy configured: proxy.server.com//8080" error comes up. How do I fix this?


Solution 1:

Set proxy details in Environment variables;
Edit /etc/environment and add following lines (replace username, password, host and port with your proxy details).

http_proxy=http://username:password@host:port/
ftp_proxy=ftp://username:password@host:port/
https_proxy=https://username:password@host:port/ 

For apt,software center & etc;
edit /etc/apt/apt.conf.d/80proxy (if its not exist create it) and add the following lines

Acquire::http::proxy "http://username:password@host:port/";
Acquire::ftp::proxy "ftp://username:password@host:port/";
Acquire::https::proxy "https://username:password@host:port/";

Solution 2:

I didn't find any proxy information in /etc/environment even on /etc/apt/apt.conf.d/80proxy, because I informed proxy value at setup.

I find it on this file: /etc/apt/apt.conf.d/90curtin-aptproxy.