How to install and configure Squid Server on Oracle Linux 9.3
- 00:48 cat /etc/os-release
- 01:00 yum install squid* -y
- 02:03 systemctl enable squid
- 02:15 systemctl start squid
- 02:37 systemctl status squid
- 02:55 vim /etc/squid/test.txt
- 03:25 vim /etc/squid/squid.conf
- 05:46 systemctl disable firewalld.service
- 06:04 systemctl stop firewalld.service
- 06:10 systemctl status firewalld.service
- 06:30 systemctl restart squid
To Install And Configure Squid Server On Oracle Linux 9.3
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 OS version by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3
Step 2: Once the OS version is checked, now install the Squid server by using the below command
[root@linuxhelp ~]# yum install squid* -y
Oracle Linux 9 BaseOS Latest (x86_64) 32 kB/s | 3.6 kB 00:00
Oracle Linux 9 BaseOS Latest (x86_64) 9.2 MB/s | 21 MB 00:02
Oracle Linux 9 Application Stream Packages (x86_64) 34 kB/s | 3.9 kB 00:00
Oracle Linux 9 Application Stream Packages (x86_64) 8.9 MB/s | 29 MB 00:03
Oracle Linux 9 UEK Release 7 (x86_64) 34 kB/s | 3.0 kB 00:00
Oracle Linux 9 UEK Release 7 (x86_64) 9.6 MB/s | 27 MB 00:02
Last metadata expiration check: 0:00:04 ago on Tuesday 12 March 2024 04:50:20 AM.
Dependencies resolved.
=================================================================================================================================================================================================
Package Architecture Version Repository Size
=================================================================================================================================================================================================
Installing:
squid x86_64 7:5.5-6.0.1.el9_3.5 ol9_appstream 5.7 M
Installing dependencies:
httpd-filesystem noarch 2.4.57-5.0.1.el9 ol9_appstream 12 k
libecap x86_64 1.0.1-10.el9 ol9_appstream 30 k
Transaction Summary
=================================================================================================================================================================================================
Install 3 Packages
Total download size: 5.7 M
Installed size: 12 M
Downloading Packages:
(1/3): httpd-filesystem-2.4.57-5.0.1.el9.noarch.rpm 61 kB/s | 12 kB 00:00
(2/3): libecap-1.0.1-10.el9.x86_64.rpm 156 kB/s | 30 kB 00:00
(3/3): squid-5.5-6.0.1.el9_3.5.x86_64.rpm 7.4 MB/s | 5.7 MB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 7.4 MB/s | 5.7 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: squid-7:5.5-6.0.1.el9_3.5.x86_64 1/1
Preparing : 1/1
Installing : libecap-1.0.1-10.el9.x86_64 1/3
Running scriptlet: httpd-filesystem-2.4.57-5.0.1.el9.noarch 2/3
Installing : httpd-filesystem-2.4.57-5.0.1.el9.noarch 2/3
Running scriptlet: squid-7:5.5-6.0.1.el9_3.5.x86_64 3/3
Installing : squid-7:5.5-6.0.1.el9_3.5.x86_64 3/3
Running scriptlet: squid-7:5.5-6.0.1.el9_3.5.x86_64 3/3
Verifying : httpd-filesystem-2.4.57-5.0.1.el9.noarch 1/3
Verifying : libecap-1.0.1-10.el9.x86_64 2/3
Verifying : squid-7:5.5-6.0.1.el9_3.5.x86_64 3/3
Installed:
httpd-filesystem-2.4.57-5.0.1.el9.noarch libecap-1.0.1-10.el9.x86_64 squid-7:5.5-6.0.1.el9_3.5.x86_64
Complete!
Step 3: Enable the Squid by using the below command
[root@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 ~]# systemctl start squid
Step 5: Check the Status by using the below command
[root@linuxhelp ~]# systemctl status squid
● squid.service - Squid caching proxy
Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled; preset: di>
Active: active (running) since Wed 2024-03-13 23:25:11 IST; 12s ago
Docs: man:squid(8)
Process: 103159 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited,>
Main PID: 103161 (squid)
Tasks: 3 (limit: 21644)
Memory: 14.4M
CPU: 264ms
CGroup: /system.slice/squid.service
├─103161 /usr/sbin/squid --foreground -f /etc/squid/squid.conf
├─103163 "(squid-1)" --kid squid-1 --foreground -f /etc/squid/squi>
└─103164 "(logfile-daemon)" /var/log/squid/access.log
Mar 13 23:25:10 linuxhelp systemd[1]: Starting Squid caching proxy...
Mar 13 23:25:10 linuxhelp squid[103161]: Squid Parent: will start 1 kids
Mar 13 23:25:10 linuxhelp squid[103161]: Squid Parent: (squid-1) process 103163>
Mar 13 23:25:11 linuxhelp systemd[1]: Started Squid caching proxy.
Step 6: Create a file and insert the domain names in squid directory by using the below command
[root@linuxhelp ~]# vim /etc/squid/test.txt
.facebook.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 2 sites and to block other sites in Squid configuration by using the below command
[root@linuxhelp ~]# vim /etc/squid/squid.conf
acl list src 192.168.6.140/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 ~]# systemctl disable firewalld.service
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@linuxhelp ~]# systemctl stop firewalld.service
[root@linuxhelp ~]# systemctl status firewalld.service
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; prese>
Active: inactive (dead)
Docs: man:firewalld(1)
Jan 07 03:08:01 linuxhelp systemd[1]: Starting firewalld - dynamic firewall dae>
Jan 07 03:08:02 linuxhelp systemd[1]: Started firewalld - dynamic firewall daem>
Jan 07 03:24:10 linuxhelp systemd[1]: Stopping firewalld - dynamic firewall dae>
Jan 07 03:24:11 linuxhelp systemd[1]: Started firewalld - dynamic firewall daem>
Mar 13 23:29:01 linuxhelp systemd[1]: Stopping firewalld - dynamic firewall dae>
Mar 13 23:29:01 linuxhelp systemd[1]: firewalld.service: Deactivated successful>
Mar 13 23:29:01 linuxhelp systemd[1]: Stopped firewalld - dynamic firewall daem>
Step 9: Restart the squid by using the below command
[root@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

Conclusion :
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 9.3. Your feedback is much welcome.
Comments ( 0 )
No comments available