22 C
Texas

How to Configure Proxy Settings on CentOS / RHEL / Fedora

Introduction:

In this tutorial, we are going to learn that how can we configure our Proxy Settings on CentOS 8 / 7 | RHEL 8 / 7 & Fedora 31/30/29 Linux machines. You’ll learn that how can you configure access to Internet via proxy server on any Linux system. You will be required to 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

To make changes on the system control panel, users of Fedora / CentOS & RHEL Linux who are running Desktop environment , can follow the below steps to configure proxy on their systems.

Go to Settings

Navigate to Network >Network Proxy

- Advertisement -

Choose Manual from the menu and provide your proxy settings as you want.

Populate proxy values for http, https, & ftp. If you are using SOCKS proxy, you will also need to set it accordingly. As you will finish making changes, your system will update them automatically within no time.

Proxy on Firefox Browser

By Default you are provided with the Firefox browser on CentOS Linux so you can configure its proxy settings manually.

You can update your proxy settings by

Navigating to Preferences

Go To Network Settings> Manual Proxy Configuration

Here you can set your proxy settings. After finishing settings click on the “OK” button to save them.

Configure System-Wide Proxy Settings on CLI

To configure system-wide proxy setting with the help of CLI, we’ll create a shell script file under /etc/profile.d/proxy.sh. It will apply the settings to all logged-in users permanently.

sudo vi /etc/profile

Now 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"

Note: 10.10.1.10 is the IP of proxy server, it can be replaced easily with the host name.
8080 is the proxy server port.

If you are prompted to provide authentication details, follow the below syntax:

http://username/

Now, source the file to make use of the changes and settings you’ve applied in the proxy settings.

source /etc/profile

Make sure you’ve done correctly

env | grep -i proxy

Setting Proxy for YUM | DNF package manager

The settings we’ve done above are for the Application & command-line tools. We have to set proxy settings for YUM and DNF packages separately.

Set Proxy Settings for DNF-Fedora / CentOS / RHEL 8

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

Proxy Setting for CentOS 6/7

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

RHEL users also need to set proxy for accessing RHSM content.

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

In case, your server require authentication you will have to set it .

user name for authenticating to an http proxy, if needed
proxy_user =
password for basic http proxy auth, if needed
proxy_password =

These are the basic proxy settings. To use Internet on CentOS / RHEL 7/8 & on Fedora Linux systems you will be required to use Proxy Server.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article