GUIDE: Setting APT Proxy Server

> INIT: December 1st, 2025 > UPDATED: December 10th, 2025

TAGS_DETECTED: #Linux

Adding Proxy Settings

Setting Proxy for APT

First create a file to hold the proxy settings, put this in the Linux Terminal

 
sudo nano /etc/apt/apt.conf.d/02proxy

Copy the code below, right click to paste in Putty window.

 
Acquire {
HTTP::proxy "http://x.x.x.x:3128";
HTTPS::proxy "http://x.x.x.x:3128";
}

Press CTRL+O to save the file, followed by CTRL+X to close the nano editor. 

Setting Proxy for curl/wget

Temporary Proxy Settings Command

If you need to add immediate proxy settings but only need this temporarily. Run this in your shell:

export http_proxy="http://x.x.x.x:3128"
export https_proxy="http://x.x.x.x:3128"
export HTTP_PROXY="http://x.x.x.x:3128"
export HTTPS_PROXY="http://x.x.x.x:3128"

Permanent/Persistent Proxy Settings

However, you might want proxy settings to be persistent after a reboot. To do this we perform the following steps.

All Users

Using an administrator account, open /etc/environment into a text editor (nano).

 
sudo nano /etc/environment

Add the following lines, modifying them to fit your environment file.

http_proxy="http://x.x.x.x:3128"
https_proxy="http://x.x.x.x:3128"
HTTP_PROXY="http://x.x.x.x:3128"
HTTPS_PROXY="http://x.x.x.x:3128"

// COMMENTS_DISABLED_BY_ADMIN