All locations active · 99.99% uptime
Setup

Ubuntu and Linux Proxy Settings

On Linux there is no single place called "the system proxy". The desktop environment, the package manager, the service manager and the container runtime each read proxy information independently of one another . The map below shows which file affects which component.

FIGUREWhere proxy configuration is scattered on Linux
MAPLinux proxy configurationShell / userenvironment variables~/.bashrc/etc/environmentexport HTTP_PROXYPackage managerapt, snap, dnf/etc/apt/apt.conf.d/95proxysnap set system proxy.httpdnf.confServicessystemd unitssystemctl edit <service>Environment=HTTP_PROXYdaemon-reloadDesktopGNOME / KDEgsettingsSettings → NetworkGUI applications only

Configuring one layer does not automatically configure another. That is the source of the classic "apt works but curl doesn't" picture.

1. Environment Variables (Shell Layer)

This is the most common and most portable method. To make it permanent, write it into ~/.bashrc (user only) or /etc/environment (system-wide):

FIGURESystem-wide environment variables
/etc/environment01http_proxy="http://185.93.68.14:8080/"02https_proxy="http://185.93.68.14:8080/"03ftp_proxy="http://185.93.68.14:8080/"04no_proxy="localhost,127.0.0.1,::1,.local,10.0.0.0/8"0506# Also define the uppercase equivalents: some tools07# only read the HTTP_PROXY form.08HTTP_PROXY="http://185.93.68.14:8080/"09HTTPS_PROXY="http://185.93.68.14:8080/"10NO_PROXY="localhost,127.0.0.1,::1,.local"

For addresses with authentication the format is http://kullanici:sifre@ip:port/ ; write the special characters in the password using percent encoding (@%40).

The change takes effect in a new session; to try it right away, source /etc/environment is not enough, because the file is not a shell script — log out and back in.

2. APT and Snap

apt, because it runs as root, does not see user environment variables. A separate file is required:

  • /etc/apt/apt.conf.d/95proxy , add: Acquire::http::Proxy "http://185.93.68.14:8080/";
  • A second line for HTTPS repositories: Acquire::https::Proxy "http://185.93.68.14:8080/";
  • For Snap: sudo snap set system proxy.http="http://185.93.68.14:8080"

The semicolon at the end of the line is mandatory; if it is omitted, apt returns a "syntax error" and cannot reach any repository.

3. systemd Services

Services such as Docker, containerd and GitLab Runner run in their own environment. The correct method is to add a drop-in file:

FIGUREAdding a proxy to a systemd service
1systemctl editan editor opens with theservice name2[Service] blockEnvironment lines areadded3daemon-reloadthe unit is re-read4restartthe service starts with the new environmentSTEPSVerify with systemctl show <service> --property=Environment

sudo systemctl edit docker[Service] under it: Environment="HTTP_PROXY=http://…"sudo systemctl daemon-reload && sudo systemctl restart docker.

4. GNOME Desktop

The Settings → Network → Network Proxy section affects only GTK applications. If you want to manage it from the command line: gsettings set org.gnome.system.proxy mode 'manual' and then gsettings set org.gnome.system.proxy.http host '185.93.68.14'. For SOCKS, use the org.gnome.system.proxy.socks schema.

Verification Matrix

FIGUREWhich command tests which layer?
VALIDATIONEnv. varsAPTsystemdGNOMEcurl ifconfig.mestrongweakweakweaksudo apt updateweakstrongweakweakdocker pull alpineweakweakstrongweakOpening a site in Firefoxweakweakweakstrong

Each line tests only one layer. Do not say "the proxy is set up" before running all four.

If you suspect the address itself, first use Proxy Check to measure whether it is alive; whether the problem is in the configuration or in the address — that distinction halves your troubleshooting time.

For the desktop equivalent, see the Windows 11 and macOS guides; for the protocol decision, see the HTTP–SOCKS5 comparison . For server-side workloads, datacenter proxy packages are a good fit.

Frequently Asked Questions

01Can I put a CIDR range in no_proxy?

It depends on the tool. curl and wget expect a list of domains and IPs; some Go-based tools support CIDR. The safest approach is to list both the domain and the IP forms together.

02The proxy does not work during a Docker build

The build environment is separate from the daemon environment. docker build --build-arg HTTP_PROXY=… You need to pass this parameter, or define the proxy in ~/.docker/config.json instead.

03Can I use a SOCKS5 proxy with apt?

Not directly supported. Acquire::http::Proxy "socks5h://ip:port/"; This form works in current apt versions; if it does not, you need to set up a local HTTP→SOCKS bridge.

Related Articles and Pages

NEXT STEP

Strengthen your proxy setup today.

Get started in minutes with a paid plan, or try our free proxy list first.

FREEPROXY.TR

Looking for a free proxy? You're in the right place

A complete proxy platform where you can browse up-to-date free proxy addresses, compare HTTP and SOCKS proxy types, and check your proxy connections with free tools.