How To Install Squid Proxy on CentOS

Published on: Sun, Oct 18, 2015 at 4:45 am EST
CentOS Linux Guides Server Apps

Squid is a popular, free Linux program that allows you to create a forwarding web proxy. In this guide, you'll see how to install Squid on CentOS to turn your server into a web proxy.

Squid can be configured as a reverse proxy as well, but that type of setup is not covered in this article.

This guide was written for CentOS 6, but should also work for CentOS 7.

Step 1: Installing Squid

I'm going to assume that you have a new CentOS server. You can now install Squid with yum:

yum install squid

Step 2: Editing configuration

You can now configure Squid. The configuration file is located at the following path:

vi /etc/squid/squid.conf

Open this file with your favorite text editor in order to configure Squid settings. You can find an overview of them on the official Squid website.

Step 3: Open port in firewall

Now open the Squid port in the firewall. The default port is 3128. If you changed it, naturally, open the port you set Squid to run on:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT

Step 3: Restarting service

You can now restart the Squid service:

service squid restart

To make Squid start every time you start your server, use chkconfig:

chkconfig squid on

In order to see your users' activity, you can use the tail command to read the logs:

tail -f /var/log/squid/access.log

Step 4:

You can now configure other computers to send their traffic through your Squid proxy. If you would like to do this on OS X, Windows, or Linux, follow this guide.

Want to contribute ?

You could earn up to $300 by adding new articles