We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Set System Proxy on Ubuntu 22.04|20.04|18.04

Learn how to – How To Set System Proxy on Ubuntu 22.04|20.04|18.04.

Here we will examine how to set system proxy settings on Ubuntu 22.04/20.04/18.04 Linux system. A proxy server, at its basic level, is a computer system with services that sits between computers making web requests (clients) and the servers containing the content being requested for (servers).

There are various ways of configuring Proxy settings on Ubuntu Linux operating systems. The graphical interface can be used, or all settings are done on the command line. In this guide, we will consider both methods.

We have a guide on how you can configure Proxy server on Ubuntu Linux in the link below:

Set System-Wide Proxy settings on GUI

For users running a Desktop edition of Ubuntu OS, changes can be made on the system control center.

on Debian: Settings > Network > Network Proxy > Manual

on Ubuntu: Settings > Network > Network Proxy > Manual

Populate proxy values for http, https, and ftp. If you have SOCKS proxy, also set it accordingly. Once changes are saved, the system will pick them automatically.

If you have Firefox browser, you need to update proxy settings under Preferences > Network Settings > Manual Proxy configuration.

Configure Proxy and click “OK” to save.

Set System-Wide Proxy settings on CLI

We will add a shell script file under /etc/profile.d/proxy.sh. This will ensure the settings apply to all logged-in users.

sudo vim /etc/profile.d/proxy.sh

Populate your proxy values.

# set proxy config via profie.d - should apply for all users
# 
export http_proxy="http://10.10.1.10:8080/"
export https_proxy="http://10.10.1.10:8080/"
export ftp_proxy="http://10.10.1.10:8080/"
export no_proxy="127.0.0.1,localhost"

# For curl
export HTTP_PROXY="http://10.10.1.10:8080/"
export HTTPS_PROXY="http://10.10.1.10:8080/"
export FTP_PROXY="http://10.10.1.10:8080/"
export NO_PROXY="127.0.0.1,localhost"

Add other IPs you want to exclude from proxy to NO_PROXY & no_proxy environment variable.

Make it executable.

sudo chmod +x  /etc/profile.d/proxy.sh

Source the file to start using the proxy settings, or alternatively logout and back in.

source /etc/profile.d/proxy.sh

Confirm:

$ env | grep -i proxy

Set proxy for APT package manager

The above settings will work for Applications and command-line tools. If you want to set proxy only for the APT package manager, configure like below.

$ sudo vim /etc/apt/apt.conf.d/80proxy
Acquire::http::proxy "http://10.10.1.10:8080/";
Acquire::https::proxy "https://10.10.1.10:8080/";
Acquire::ftp::proxy "ftp://10.10.1.10:8080/";

Replace 10.10.1.10 with the correct IP address for your proxy servers. If Authentication is required, set like this.

Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/";

Set Proxy for wget only

To set proxy settings for use with wget command, add them to ~/.wgetrc file.

$ vim ~/.wgetrc                           
use_proxy = on
http_proxy = http://10.10.1.10:8080/ 
https_proxy = http://10.10.1.10:8080/ 
ftp_proxy = http://10.10.1.10:8080/ 

That is how easy it can be to configure system-wide proxy settings on Ubuntu server or Desktop. You can also check related articles on the links below.

Cart

Your Cart is Empty

Back To Shop