How to Install Squid Proxy on CentOS 8

Install Squid Proxy on CentOS 8

In this article, we will have explained the necessary steps to installing and configure Squid Proxy on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Squid is a free and open-source high performance caching and forwarding HTTP web proxy. It also performs transparent caching that reduces bandwidth and improves response time by caching and reusing frequently-requested web pages. Squid proxy server supports caching of content requested through different protocols such as HTTP, SSL requests, DNS lookups, and FTP.

Install Squid Proxy on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Squid on CentOS system.

The squid package is available on the CentOS repository. Run this command to install it:

sudo dnf install squid

Once the installation is completed, we have a start and enable Squid service:

sudo systemctl status squid

Step 3. Configure Squid server.

The config file located on /etc/squid/squid.conf. Let’s take a backup before modifying:

sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bkp

Next, open the file with your favorite text editor:

sudo nano /etc/squid/squid.conf

These are general forward proxy settings:

[root@linuxtips ~]# nano /etc/squid/squid.conf

acl CONNECT method CONNECT
# line 29: add your local network

# network range you allow to use this proxy server

acl my_localnet src 10.0.0.0/24
# line 46: uncomment

http_access deny to_localhost
# line 55: comment out

#
http_access allow localnet
# line 57: add (allow defined ACL above)

http_access allow my_localnet
# add to the end

http_port 3128 # change to any port if needed

request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
# add (do not display IP address)

forwarded_for off
[root@linuxtips ~]# systemctl enable --now squid

Step 4. Configure Firewall for Squid.

If the firewall is enabled, allow the Squid port:

sudo firewall-cmd --add-port=3128/tcp --permanent
sudo firewall-cmd --reload

Step 5. Configure Squid Proxy Client.

All this configuration has been done to set up your Squid proxy server. Now, switch to your client machine and open your web browser. If you’re using Firefox, you can find the proxy settings under:

  • Menu > Options > Network Settings > Settings
  • Tick the radio button for Manual proxy configuration.

That’s all you need to do to install Squid on CentOS 8. I hope you find this quick tip helpful. For further reading on Squid Proxy Server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.