In this tutorial, we will show you how to install Squid Proxy on Ubuntu 22.04 LTS. For those of you who didn’t know, Squid is a popular open-source caching proxy server that allows you to improve the performance and security of your network by caching frequently accessed content. Squid provides advanced access controls and authentication mechanisms that allow you to restrict access to your network and provide a secure environment for your users. Squid Proxy is compatible with a wide range of operating systems, including Linux, Windows, and macOS. It is also compatible with a wide range of web browsers and other network applications, making it a versatile solution for organizations of all sizes.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Squid proxy server on Ubuntu 22.04. You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Squid Proxy.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Squid Proxy on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install apache2-utils apt-transport-https gnupg2 software-properties-common
Step 2. Installing Squid Proxy on Ubuntu 22.04.
By default, Squid is not available on Ubuntu 22.04 base repository. Now run the following command below to install the latest stable Squid server to your systems:
sudo apt install squid
Squid will automatically set up a background service and start after being installed. You can check that the service is running properly:
sudo systemctl status squid
Step 3. Configuring the Basic Settings Squid Proxy.
After installing Squid Proxy, you need to configure the basic settings. The configuration file for Squid Proxy is located at
/etc/squid/squid.conf. In the configuration file, you can modify various settings, such as the port number, cache size, and log file location.
First, we create our authentication file which Squid can use to verify user authentications:
htpasswd -b /etc/squid/squid_passwd [username] [password]
htpasswd -b -c /etc/squid/squid_passwd yelena belova
Next, open the configuration file by running the following command below
Add the following file:
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/squid_passwd auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours acl authenticated_users proxy_auth REQUIRED http_access allow authenticated_users
We will configure Squid to listen on port 8080, instead of the default port 3128:
Next, we will configure Squid to use the DNS servers of our choice. Add the following lines to the configuration file:
dns_nameservers 188.8.131.52 184.108.40.206
Save and close the file, then restart the Squid service to take the change effect:
sudo systemctl restart squid
Step 4. Configure Uncomplicated Firewall (UFW).
By default, the UFW firewall is enabled on Ubuntu. The next step is to configure it to allow traffic to Squid. This can be done by adding a rule to allow port 8080 traffic to pass through the firewall. You can do this by running the following commands:
sudo ufw allow 8080/tcp sudo ufw reload
Step 5. Configure Client for the Squid Proxy Server.
We will test the Squid proxy server by configuring a web browser to use it. Open your web browser and go to the network settings. In Firefox, this can be done by going to
Preferences -> Network Settings.
In the Network Settings window, select the “Manual proxy configuration” option and enter the IP address of your Squid proxy server and the port number you configured earlier (8080 in our example).
Congratulations! You have successfully installed Squid. Thanks for using this tutorial for installing the Squid proxy server on the Ubuntu system. For additional help or useful information, we recommend you check the official Squid website.