How to Set Up a Proxy on Linux (Ubuntu, Fedora, Debian)
Configure proxies on Linux for privacy, secure browsing, or bypassing restrictions. This step-by-step guide covers GUI (GNOME/KDE), system-wide, browser, and command-line proxy settings—with troubleshooting, real code examples, and security tips. Works for Ubuntu, Debian, Fedora, and more.
Introduction: Why Set Up a Proxy on Linux?
A proxy server acts as a go-between for your device and the internet—masking your IP, bypassing restrictions, or enhancing privacy. On Linux, you may need a proxy for secure browsing, accessing blocked content, automation, or privacy at home or work. This guide covers all major Linux distributions (Ubuntu, Debian, Fedora, Mint, Arch, and more) and desktop environments. Whether you want a system-wide proxy, a browser-only proxy, or need to configure command-line tools, you'll find step-by-step help here.
| Proxy Method | Coverage | Best For | Notes |
|---|---|---|---|
| GUI (GNOME/KDE) | Most desktop apps & browsers | General use, easy setup | Some apps may ignore system proxy |
| System-wide (env vars) | Most apps, CLI tools | Scripted/automation, headless servers | Needs manual config per user/app sometimes |
| Browser-specific | Just that browser | Firefox, privacy, testing | Overrides system settings (in Firefox) |
| Command-line Tools | curl, wget, apt, etc. | Automation, scripting | May need config in .bashrc or tool config |
1. Set Proxy via GNOME or KDE Desktop on Linux
Most Linux desktops make proxy setup easy. Here’s how to configure proxies using GNOME (Ubuntu, Fedora, etc.) and KDE Plasma (Kubuntu, openSUSE, etc.):
GNOME (Ubuntu, Fedora, Debian, etc.)
- Open Settings → Network.
- Scroll down and click Network Proxy.
- Choose Manual to enter proxy details, or Automatic to use a PAC file.
- Enter your HTTP, HTTPS, FTP, SOCKS proxies as provided.
- Click Apply.
KDE Plasma
- Open System Settings → Network → Settings.
- Click Proxy.
- Choose Manual or Automatic (PAC) mode.
- Fill in your proxy details, click Apply.
2. Linux System-wide Proxy Configuration (Environment Variables)
To make a proxy available to all apps and command-line tools, set environment variables for your user or system-wide:
- Open a terminal.
- Edit your shell profile (for current user):
nano ~/.bashrcornano ~/.profile - Add these lines at the end, replacing values as needed:
# For HTTP/HTTPS proxy (with authentication)
export http_proxy="http://username:password@proxy.server.com:8080/"
export https_proxy="http://username:password@proxy.server.com:8080/"
export ftp_proxy="http://username:password@proxy.server.com:8080/"
export no_proxy="localhost,127.0.0.1,::1"
- Save and exit, then reload your profile:
source ~/.bashrc - For system-wide (all users), edit
/etc/environmentand add the same lines (omitexportkeyword).
/etc/environment affects all users; ~/.bashrc is per-user. You may need to log out and back in for changes to take effect everywhere.
- Use
http://orsocks5://as appropriate for your proxy type. - Don’t forget to include
no_proxyfor local addresses. - Don’t add
exportin/etc/environment; justKEY=value. - To check if variables are set:
echo $http_proxy
3. Browser Proxy Settings (Firefox, Chrome, Chromium, etc.)
Firefox
- Go to Preferences (or Edit → Preferences).
- Scroll to Network Settings (bottom of General).
- Click Settings…
- Choose Manual proxy configuration and fill in your proxy details (HTTP/SOCKS).
- Click OK to save.
Chrome/Chromium
- Uses system settings (GNOME/KDE). To use a different proxy, launch with:
google-chrome --proxy-server="socks5://proxy.server.com:1080"
Browser Extensions
- Extensions like FoxyProxy can manage proxies and switch profiles easily.
| Browser | Proxy Uses |
|---|---|
| Firefox | Own settings panel (overrides system) |
| Chrome/Chromium | System proxy by default |
| Opera | System proxy by default |
4. Proxy for Command-line Tools (curl, wget, apt, etc.)
curl
- Environment:
export http_proxy="http://proxy.server.com:8080" - Command line:
curl --proxy http://proxy.server.com:8080 https://example.com
wget
- Edit
~/.wgetrcand add:http_proxy = http://proxy.server.com:8080
apt (Debian/Ubuntu)
- Create
/etc/apt/apt.conf.d/99proxywith:Acquire::http::Proxy "http://proxy.server.com:8080/";
http_proxy, others HTTP_PROXY (case matters for some shells).
sudo, make sure proxy variables are exported for the root user too, or use sudo -E to preserve environment.
Troubleshooting & FAQ: Linux Proxy Configuration
http://username:password@proxy.server.com:8080. For extra security, avoid putting passwords in plain text—use environment variables only in your own user profile, or use tools that support credential prompts. Some tools (like wget) can use a .netrc file for credentials.curl ifconfig.me (with your proxy active) to see if your IP changes. If you see your proxy's IP, the connection is active.http_proxy and related variables. For browsers, see if they use their own proxy settings. Always test with your target app after setup./etc/environment, reboot to be sure.