How to install Squid Proxy Server on Ubuntu 20.04 LTS Linux

Installing Squid Proxy Server on Ubuntu 20.04 LTS Linux can be done in a few simple steps. Here is an overview of the process:

  1. Update your package lists by running the command:
sudo apt update
  1. Install Squid by running the command:
sudo apt install squid
  1. Once the installation is completed, the Squid service will start automatically. You can check the status of the service by running the command:
sudo systemctl status squid
  1. The default configuration file for Squid is located at /etc/squid/squid.conf. You can edit this file to change the default settings, such as the listening IP and port, access control, and caching options.
  2. To allow client access to the proxy server, you need to configure the firewall to allow incoming connections on the port that Squid is listening on. By default, Squid listens on port 3128. You can open this port by running the command:
sudo ufw allow 3128
  1. To apply the changes to the firewall, you need to reload the firewall by running the command:
sudo ufw reload
  1. To test that the proxy server is working correctly, you can use the curl command to download a file via the proxy. You can do this by running the command:
curl -x http://<proxy-server-ip>:3128 http://www.example.com
  1. Once you’ve confirmed that the proxy server is working correctly, you should configure access control to limit which clients can connect to the proxy server. You can do this by editing the /etc/squid/squid.conf file and adding an acl section that defines the IP addresses or subnets that are allowed to connect to the proxy server.
  2. To make sure that the changes you’ve made to the configuration file are valid, you can check the syntax of the file by running the command:
sudo squid -k check
  1. Finally, you need to restart the Squid service to apply the changes by running the command:
sudo systemctl restart squid

It’s important to note that, the above-explained steps are a basic setup and it should be used only for testing or in a secure environment. It is recommended to use a more secure setup with stronger encryption and authentication methods, also you should configure firewall rules to protect the Squid proxy server.

Leave a Comment