AMP AMP

How to Install and Configure Squid Server on Linux Mint 20

To Install and Configure Squid Server on Linux Mint 20

Introduction:

Install & Configure the Squid server on LinuxMint20: A proxy server is acting as a gateway between the user and the internet. It is used to restrict websites and browsers from particular users. This tutorial covers the installation process of the squid proxy on LinuxMint 20. Let check the version of the OS by using the following command

root@linuxhelp:~# cat /etc/os-release
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal

Once the OS version is checked, now install the squid server by using the following command

root@linuxhelp:~# apt-get install squid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
.
.
.
  libdbi-perl libecap3 squid-common squid-langpack
Processing triggers for ufw (0.36-6) ...
Processing triggers for systemd (245.4-4ubuntu3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...

After the squid is installed, now start the squid service by using the following command

root@linuxhelp:~# systemctl start squid

After the squid service is started. Check the status of the squid service by using the following command

root@linuxhelp:~# systemctl status squid
● squid.service - Squid Web Proxy Server
     Loaded: loaded (/lib/systemd/system/squid.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-11-04 09:25:17 IST; 5h 40min ago
       Docs: man:squid(8)
    Process: 5768 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
   Main PID: 2646 (squid)
      Tasks: 4 (limit: 2244)
     Memory: 17.0M
     CGroup: /system.slice/squid.service
             ├─2646 /usr/sbin/squid -sYC
             ├─2648 (squid-1) --kid squid-1 -sYC
             ├─5769 (logfile-daemon) /var/log/squid/access.log
             └─5770 (pinger)

Nov 04 14:51:55 linuxhelp squid[2648]: Squid plugin modules loaded: 0
Nov 04 14:51:55 linuxhelp squid[2648]: Adaptation support is off.
Nov 04 14:51:55 linuxhelp squid[2648]: Store logging disabled
Nov 04 14:51:55 linuxhelp squid[2648]: DNS Socket created at [::], FD 11
Nov 04 14:51:55 linuxhelp squid[2648]: DNS Socket created at 0.0.0.0, FD 12
Nov 04 14:51:55 linuxhelp squid[2648]: Adding nameserver 127.0.0.53 from /etc/resolv.conf
Nov 04 14:51:55 linuxhelp squid[2648]: HTCP Disabled.
Nov 04 14:51:55 linuxhelp squid[2648]: Pinger socket opened on FD 15
Nov 04 14:51:55 linuxhelp squid[2648]: Finished loading MIME types and icons.
Nov 04 14:51:55 linuxhelp squid[2648]: Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 13 flags=9

After the squid server status is checked. Let configure some rules using squid.conf file

root@linuxhelp:~# vi /etc/squid/squid.conf
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
include /etc/squid/conf.d/*
acl newlist src 192.168.7.236
acl blok dstdomain "/etc/squid/block.txt"
http_access deny newlist blok
http_access allow newlist

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
#http_access allow localnet
http_access allow localhost

After the configuration is complete. Let configure block.txt by using the following command.

root@linuxhelp:~# vi /etc/squid/block.txt
facebook.com
google.com

After the configuration is complete, now reload the squid service by using the following command

root@linuxhelp:~# service squid reload

Open the setting on browser and clock preference Click the network setting option Configure Proxy Access to the Internet Here the facebook.com is blocked by squid proxy service Here the google.com is blocked by squid proxy service Here the Instagram page will be allowed by the squid server

The installation process of the Squid Proxy server on LinuxMint 20 comes to an end.

FAQ
Q
What is the file format of Squid stores data?
A
Squid stores data file format is UFS(Universal Flash Storage).
Q
Which protocols support the squid server?
A
The squid server supports HTTP, FTP, SSL, DNS protocols.
Q
Which command is used to restart the squid service?
A
To restart the squid service use systemctl.
Q
Where the squid proxy configuration location?
A
The location of the squid proxy configuration file is /etc/squid/squid.conf.
Q
What is the port number of squid proxy?
A
The port number of squid proxy is 3128.