Menu
User

DropVPS Team

Writer: John hens

how to set proxy in ubuntu 25.10 command line

how to set proxy in ubuntu 25.10 command line

Publication Date

11/10/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Configuring a proxy in Ubuntu 25.10 is essential for situations where you need to route network traffic through a proxy server for privacy, security, or bypassing network restrictions. By setting the proxy correctly at the system level, you can ensure that terminal commands, package management, and applications follow the proxy settings consistently.

Step 1: Set a Temporary Proxy

A temporary proxy affects only the current terminal session and is useful for testing or short-term usage. You can set HTTP, HTTPS, and FTP proxies with the following commands:

export http_proxy="http://username:password@proxyserver:port"
export https_proxy="https://username:password@proxyserver:port"
export ftp_proxy="ftp://username:password@proxyserver:port"
export no_proxy="localhost,127.0.0.1,::1"

Step 2: Set a Permanent Proxy

For system-wide proxy settings, you can add the configuration to /etc/environment. This makes the proxy persistent across reboots and available to all users and services:

sudo nano /etc/environment
# Add the following lines:
http_proxy="http://username:password@proxyserver:port"
https_proxy="https://username:password@proxyserver:port"
ftp_proxy="ftp://username:password@proxyserver:port"
no_proxy="localhost,127.0.0.1,::1"

After saving the file, apply the changes by running:

source /etc/environment

Step 3: Configure Proxy for APT

The Advanced Package Tool (APT) does not always use the system proxy automatically. To set a proxy specifically for APT, create a configuration file in /etc/apt/apt.conf.d/:

sudo nano /etc/apt/apt.conf.d/95proxies
# Add these lines:
Acquire::http::Proxy "http://username:password@proxyserver:port/";
Acquire::https::Proxy "https://username:password@proxyserver:port/";
Acquire::ftp::Proxy "ftp://username:password@proxyserver:port/";

Step 4: Configure Proxy for Curl

To ensure that all curl requests use the proxy server correctly, you need to set the proxy in its configuration file. This helps maintain consistent network behavior for scripts and commands that rely on

sudo nano ~/.curlrc
# Add:
proxy = http://username:password@proxyserver:port

You can also test the proxy directly with a curl command:

curl -I http://example.com
ChatGPT said:

Step 5: Verify Proxy Settings

After configuring your proxy, it’s important to verify that all system and application requests are correctly routed through the proxy. This ensures that your network traffic follows the intended settings and avoids connectivity issues.

echo $http_proxy
curl -I http://example.com
wget --spider http://example.com

Step 6: Remove or Disable Proxy

If you no longer need a proxy or want to test direct connections, you can remove or disable the proxy settings. This ensures your system and applications return to normal network behavior without routing traffic through the proxy.

unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy
Linux VPS
U
Loading...

Related Posts

how to set proxy in ubuntu 25.10 command line