The process of setting up a proxy on Linux may vary depending on the Linux distribution. The following instructions have been tested on Centos 7.9 and Ubuntu 20.04.

In the Linux operating system, you can set up a proxy by defining environment variables. The table below lists all proxy-related environment variables.

Environment VariablesDescription
http_proxySpecify a proxy server for routing HTTP traffic.
https_proxySpecify a proxy server for routing HTTPS traffic
ftp_proxySpecify a proxy server for routing FTP traffic
all_proxySpecify a proxy server for routing all traffic
no_proxyHost or domain names that do not require proxies. Wildcard characters can be used

Proxy Settings For Current User

You can simply set up proxy settings for routing HTTP and HTTPS traffic for the current user by using the following command. Don’t forget to replace username, password, proxy_server, and port with yours.

To remove proxy settings, simply use following command:

Bash
unset {http_proxy,https_proxy}

Global Proxy Settings

Global proxy settings will affect every user in the Linux operating system. Please confirm the impact and decide whether to configure them or not..

/etc/profile contains system-wide environment settings and configurations that are applied to all users on the system. It will be executed for login shells and source every shell script under the /etc/profile.d directory.