How to Install and Configure Squid on Oracle Linux 8.5
To Install and Configure Squid on Oracle Linux 8.5
Introduction:
Squid is an open-source web proxy cache server with features. It is used to block websites and file formats. It is a caching proxy server widely used on Linux and Unix. As a result, requested Internet objects, such as data on a Web server or an FTP server, are stored on a machine closer to the requesting workstation than the server.
Installation Steps:
Step 1: Check the oracle Linux version by using the below command
[root@linuxhelp linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
Step 2: Install squid by using the below command
[root@linuxhelp linuxhelp]# yum -y install squid
Total download size: 3.7 M
Installed size: 12 M
Downloading Packages:
(1/3): libecap-1.0.1-2.module+el8.3.0+7819+eb7d4ef6.x86_ 153 kB/s | 29 kB 00:00
(2/3): perl-Digest-SHA-6.02-1.el8.x86_64.rpm 342 kB/s | 66 kB 00:00
(3/3): squid-4.15-3.module+el8.6.0+20529+9782b8ab.x86_64 13 MB/s | 3.6 MB 00:00
-----------------------------------------------------------------------------------------
Installed:
libecap-1.0.1-2.module+el8.3.0+7819+eb7d4ef6.x86_64
perl-Digest-SHA-1:6.02-1.el8.x86_64
squid-7:4.15-3.module+el8.6.0+20529+9782b8ab.x86_64
Complete!
Step 3: Enable the Squid by using the below command
[root@linuxhelp linuxhelp]# systemctl enable squid
Created symlink /etc/systemd/system/multi-user.target.wants/squid.service → /usr/lib/systemd/system/squid.service.
Step 4: Start the Squid by using the below command
[root@linuxhelp linuxhelp]# systemctl start squid
Step 5: Check the Status by using the below command
[root@linuxhelp linuxhelp]# systemctl status squid
● squid.service - Squid caching proxy
Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled; vendor preset: disabl>
Active: active (running) since Sun 2022-05-29 04:52:02 IST; 7s ago
Docs: man:squid(8)
Step 6: Create a file and insert the domain names in squid directory by using the below command
[root@linuxhelp linuxhelp]# vim /etc/squid/test.txt
.facebook.com
.youtube.com
.linuxhelp.com
Step 7: Open the configuration file by using the below command
[root@linuxhelp /]# vim /etc/squid/squid.conf
uncomment the localnet and localhost in squid configuration
#http_access allow localnet
#http_access allow localhost
Now change from deny to allow HTTP access
And finally deny all other access to this proxy
http_access allow all
Create rule to allow only 3 sites and to block other sites in Squid configuration by using the below command
[root@linuxhelp linuxhelp]# vim /etc/squid/squid.conf
acl list src 192.168.6.127/23
acl domain dstdomain "/etc/squid/test.txt"
http_access allow list domain
http_access deny list
Step 8: Disable, Stop and Check the Status of Firewall by using the below command
[root@linuxhelp linuxhelp]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@linuxhelp linuxhelp]# systemctl stop firewalld
[root@linuxhelp linuxhelp]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: e>
Active: inactive (dead)
Docs: man:firewalld(1)
Step 9: Restart the squid by using the below command
[root@linuxhelp linuxhelp]# systemctl restart squid
Step 10: Open Windows machine and change proxy server as shown in the below image
Step 11: Open Web browser and search the domain inserted in etc/squid/test.txt as shown in the below image.
Allowed domains
Blocked Domains
Step 12: Again Open the Configuration and create rule to allow all sites and block only 3 site by using the below command
[root@linuxhelp linuxhelp]# vim /etc/squid/squid.conf
acl list src 192.168.6.127/23
acl domain dstdomain "/etc/squid/test.txt"
http_access deny list domain
http_access allow list
Step 13: Restart the squid
[root@linuxhelp linuxhelp]# systemctl restart squid
Step 14 ::Open Web browser and search the domain inserted in etc/squid/test.txt
Blocked Sites
We have reached the end of this article. In this guide, we have walked you through the steps required to Installation and Configuration of Squid on Oracle Linux 8.5. Your feedback is much welcome.