How can I configure System wide proxy settings on CentOS 8/7 or Fedora 31/30/29 or RHEL 8/7 Linux machine?. Our guide will discuss how you can configure access to internet via proxy server on a Linux machine. This will include the use of wget, lynx, or curl utilities from a command line as well as package management tools.

Configure System-Wide Proxy settings on Desktop UI

For users running a Desktop environment on Fedora / CentOS and RHEL Linux, changes can be made on the system control panel.

Navigate to Settings > Network > Network Proxy

Select “Manual” to input proxy settings.

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.

Proxy on Firefox Browser

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

Configure Proxy settings and click “OK” to save.

Configure 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 vi /etc/profile

Add your proxy settings.

# set proxy config via profie.d - should apply for all users
# 
PROXY_URL="http://10.10.1.10:8080/"

export http_proxy="$PROXY_URL"
export https_proxy="$PROXY_URL"
export ftp_proxy="$PROXY_URL"
export no_proxy="127.0.0.1,localhost"

# For curl
export HTTP_PROXY="$PROXY_URL"
export HTTPS_PROXY="$PROXY_URL"
export FTP_PROXY="$PROXY_URL"
export NO_PROXY="127.0.0.1,localhost"

Where:

  • 10.10.1.10 is the proxy server ip, can be replaced with hostname
  • 8080 is the proxy server port

If authentication is required, the syntax is:

http://username:[email protected]:proxyport/

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

$ source /etc/profile

Confirm:

$ env | grep -i proxy

Set proxy for YUM|DNF package manager

The above settings will work for Applications and command-line tools but not for YUM and DNF package management tools.

For DNF – Fedora / CentOS/RHEL 8

$ sudo vim /etc/dnf/dnf.conf

# Add
proxy=http://proxyserver:port

For CentOS 6/7:

$ sudo vim /etc/yum.conf
proxy=http://proxyserver:port

For RHEL users, you’ll also need to set Proxy for accessing RHSM content:

$ sudo vi /etc/rhsm/rhsm.conf
# Configure
proxy_hostname = proxy.example.com
proxy_port = 8080

If your proxy server requires authentication, also set

# user name for authenticating to an http proxy, if needed
proxy_user =

# password for basic http proxy auth, if needed
proxy_password =

That’s the basic settings you’ll need to use proxy server to access internet on CentOS/RHEL 7&8 and on Fedora Linux machines.

For Ubuntu/Debian, check:

How To Set System Wide Proxy on Ubuntu / Debian Linux