How to Set Up a Proxy on Ubuntu Linux (GUI and Terminal Methods)
Linux is the operating system of choice for many developers, system administrators, and data professionals who rely on proxies for web scraping, network testing, and privacy. Ubuntu, as the most popular Linux distribution, offers multiple ways to configure proxy settings — from a graphical interface to terminal commands and configuration files.
This guide covers every method for setting up proxies on Ubuntu Linux, including system-wide configuration, per-application settings, and persistent configurations that survive reboots.
Why Use a Proxy on Linux
Linux systems are frequently used for tasks that benefit from proxy routing:
- Automated web scraping — Linux servers often run scrapers that require IP rotation. See our web scraping proxy guide for detailed strategies.
- Package manager access — Some networks require proxies for
apt,pip, ornpmto reach external repositories. - Server administration — Route outbound traffic through a proxy for security auditing.
- Development and testing — Test applications with different IP addresses and locations.
- Privacy — Hide your server’s real IP when making outbound requests.
Method 1: Configure a Proxy via Ubuntu GUI (GNOME Settings)
Ubuntu’s default GNOME desktop includes a graphical proxy configuration tool.
Step 1: Open Network Settings
- Click the system menu in the top-right corner of the screen.
- Click the gear icon to open Settings.
- Click Network in the left sidebar.
Step 2: Configure Proxy
- Click the gear icon next to Network Proxy.
- Change the method from None to Manual.
- Enter your proxy details:
| Protocol | Host | Port |
|---|---|---|
| HTTP Proxy | proxy.example.com | 8080 |
| HTTPS Proxy | proxy.example.com | 8443 |
| SOCKS Host | proxy.example.com | 1080 |
- In the Ignore Hosts field, add addresses that should bypass the proxy:
localhost, 127.0.0.0/8, ::1
Step 3: Apply and Verify
The settings apply immediately for GNOME-integrated applications. Open Firefox and visit whatismyipaddress.com to verify.
Note: GNOME proxy settings only affect applications that use the GSettings/dconf system. Many CLI tools and servers ignore these settings.
Method 2: Set Environment Variables (Terminal)
Environment variables are the most common way to configure proxies for command-line tools on Linux.
Temporary (Current Session Only)
export http_proxy="http://username:password@proxy.example.com:8080"
export https_proxy="http://username:password@proxy.example.com:8080"
export ftp_proxy="http://username:password@proxy.example.com:8080"
export no_proxy="localhost,127.0.0.1,::1,.local"
# Some tools check uppercase versions
export HTTP_PROXY="$http_proxy"
export HTTPS_PROXY="$https_proxy"
export NO_PROXY="$no_proxy"Permanent (Current User)
Add the export commands to your shell profile:
# For bash users
nano ~/.bashrc
# For zsh users
nano ~/.zshrcAdd the following lines at the end of the file:
export http_proxy="http://proxy.example.com:8080"
export https_proxy="http://proxy.example.com:8080"
export no_proxy="localhost,127.0.0.1,.local"Reload the profile:
source ~/.bashrc # or source ~/.zshrcSystem-Wide (All Users)
Create a proxy configuration file that applies to all users:
sudo nano /etc/profile.d/proxy.shAdd:
export http_proxy="http://proxy.example.com:8080"
export https_proxy="http://proxy.example.com:8080"
export no_proxy="localhost,127.0.0.1,.local"Make it executable:
sudo chmod +x /etc/profile.d/proxy.shThis takes effect on the next login for all users.
Method 3: Configure Proxy for APT Package Manager
Ubuntu’s APT package manager has its own proxy configuration that is separate from environment variables.
Temporary (Single Command)
sudo apt -o Acquire::http::Proxy="http://proxy.example.com:8080" updatePermanent APT Proxy Configuration
Create a dedicated configuration file:
sudo nano /etc/apt/apt.conf.d/95proxiesAdd the following:
Acquire::http::Proxy "http://username:password@proxy.example.com:8080";
Acquire::https::Proxy "http://username:password@proxy.example.com:8443";
Acquire::ftp::Proxy "http://username:password@proxy.example.com:8080";Save the file. APT will use these proxy settings for all future operations.
Verify APT Proxy
sudo apt updateIf the update completes successfully and downloads package lists, your proxy is working.
Method 4: Configure Proxy Using gsettings (GNOME CLI)
You can set GNOME proxy settings from the terminal using gsettings:
# Set proxy mode to manual
gsettings set org.gnome.system.proxy mode 'manual'
# Configure HTTP proxy
gsettings set org.gnome.system.proxy.http host 'proxy.example.com'
gsettings set org.gnome.system.proxy.http port 8080
# Configure HTTPS proxy
gsettings set org.gnome.system.proxy.https host 'proxy.example.com'
gsettings set org.gnome.system.proxy.https port 8443
# Configure SOCKS proxy
gsettings set org.gnome.system.proxy.socks host 'proxy.example.com'
gsettings set org.gnome.system.proxy.socks port 1080
# Set authentication (HTTP)
gsettings set org.gnome.system.proxy.http authentication-user 'username'
gsettings set org.gnome.system.proxy.http authentication-password 'password'
gsettings set org.gnome.system.proxy.http use-authentication true
# Set ignore hosts
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '::1']"Disable Proxy via gsettings
gsettings set org.gnome.system.proxy mode 'none'Method 5: Configure SOCKS5 Proxy with SSH Tunnel
If you have SSH access to a remote server, you can create a SOCKS5 proxy tunnel without any additional software:
ssh -D 1080 -f -C -q -N user@remote-server.comFlags explained:
-D 1080— Creates a SOCKS proxy on local port 1080-f— Runs in the background-C— Enables compression-q— Quiet mode-N— No remote command execution
Then configure applications to use 127.0.0.1:1080 as a SOCKS5 proxy.
Use the SSH Tunnel with curl
curl --socks5 127.0.0.1:1080 https://api.ipify.orgMethod 6: Configure Proxy in /etc/environment
The /etc/environment file provides system-wide environment variables that affect all users and services:
sudo nano /etc/environmentAdd:
http_proxy="http://proxy.example.com:8080"
https_proxy="http://proxy.example.com:8080"
no_proxy="localhost,127.0.0.1,.local"Important: This file does not support export syntax — just use key="value" format.
Reboot or log out and back in for changes to take effect.
Configuring Proxy for Specific Linux Tools
wget
Create or edit ~/.wgetrc:
http_proxy = http://proxy.example.com:8080
https_proxy = http://proxy.example.com:8080
use_proxy = oncurl
Create or edit ~/.curlrc:
proxy = http://proxy.example.com:8080pip (Python)
pip install package-name --proxy http://proxy.example.com:8080Or permanently in ~/.config/pip/pip.conf:
[global]
proxy = http://proxy.example.com:8080snap
sudo snap set system proxy.http="http://proxy.example.com:8080"
sudo snap set system proxy.https="http://proxy.example.com:8080"Troubleshooting Linux Proxy Issues
Proxy Works in Terminal but Not in GUI Apps
GUI applications often use GNOME/dconf settings rather than environment variables. Configure the proxy in both places for full coverage.
sudo Commands Do Not Use Proxy
By default, sudo resets environment variables. Preserve them with:
sudo -E apt updateOr configure sudoers to keep proxy variables:
sudo visudoAdd:
Defaults env_keep += "http_proxy https_proxy no_proxy"Connection Refused Errors
- Verify the proxy server is reachable:
telnet proxy.example.com 8080 - Check for firewall rules blocking outbound connections:
sudo iptables -L - Ensure the proxy credentials are correct
Slow Downloads Through Proxy
Free proxies are often heavily congested. A premium mobile proxy service provides dedicated bandwidth and consistent speeds. For definitions of proxy terminology you encounter, our proxy glossary is a helpful reference.
Quick Reference: Proxy Configuration Cheat Sheet
| Method | Scope | Persistent | CLI Tools | GUI Apps |
|---|---|---|---|---|
| Environment variables | Session/User | Optional | Yes | No |
| /etc/environment | System | Yes | Yes | Partial |
| GNOME Settings | Desktop | Yes | No | Yes |
| gsettings | Desktop | Yes | No | Yes |
| apt.conf | APT only | Yes | APT only | No |
| /etc/profile.d/ | All users | Yes | Yes | No |
Conclusion
Ubuntu Linux provides extensive proxy configuration options to suit every use case. For most desktop users, combining GNOME settings with environment variables provides comprehensive coverage. Server administrators should focus on /etc/environment and application-specific configurations like apt.conf. Whichever method you choose, always verify your setup by checking your public IP and testing the specific tools you need to route through the proxy.
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- Backconnect Proxies Deep Dive: Architecture and Real-World Performance
- Best Proxies in Southeast Asia: Singapore, Thailand, Indonesia, Philippines
- How to Build a 4G/5G Mobile Proxy Farm with Raspberry Pi
- Common cURL and Python Requests Proxy Errors (With Code Fixes)
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- Anti-Bot Detection Glossary: 50+ Terms Defined
- Anti-Bot Terminology Glossary: Complete A-Z Reference 2026
- Backconnect Proxies Deep Dive: Architecture and Real-World Performance
- Best Proxies in Southeast Asia: Singapore, Thailand, Indonesia, Philippines
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- 403 Forbidden Error: What It Means & How to Fix It
- 407 Proxy Authentication Required: Fix Guide
- Anti-Bot Detection Glossary: 50+ Terms Defined
- Anti-Bot Terminology Glossary: Complete A-Z Reference 2026