How to Install Squid on CentOS 6.3

Squid is a popular open-source proxy server that is widely used to improve network performance by caching frequently used web pages. It also helps to increase security and privacy by filtering content and blocking access to malicious websites.

In this short tutorial, we will show you how to install Squid on CentOS 6.3.

Step 1: Update the System

Before installing Squid, it’s essential to update your system to ensure that you have the latest security patches and software updates. To update the system, run the following command:

sudo yum update

Step 2: Install Squid

Once the system is updated, you can proceed to install Squid by running the following command:

sudo yum install squid

The command will download and install Squid and its dependencies.

Example:

[root@centos63 ~]# yum install squid -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirror1.ku.ac.th
 * extras: mirror.yourconnect.com
 * updates: mirror1.ku.ac.th
CentOS6.3-Repository                                                         | 4.0 kB     00:00 ...
CentOS6.3-Repository/primary_db                                              | 3.5 MB     00:00 ...
base                                                                         | 3.7 kB     00:00
base/primary_db                                                              | 3.5 MB     00:31
extras                                                                       | 3.0 kB     00:00
extras/primary_db                                                            | 6.4 kB     00:00
updates                                                                      | 3.5 kB     00:00
updates/primary_db                                                           | 2.2 MB     00:19
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package squid.i686 7:3.1.10-1.el6_2.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package         Arch           Version                        Repository                      Size
====================================================================================================
Installing:
 squid           i686           7:3.1.10-1.el6_2.4             CentOS6.3-Repository           1.7 M

Transaction Summary
====================================================================================================
Install       1 Package(s)

Total download size: 1.7 M
Installed size: 5.7 M
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.7 M
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : 7:squid-3.1.10-1.el6_2.4.i686                                                    1/1
  Verifying  : 7:squid-3.1.10-1.el6_2.4.i686                                                    1/1

Installed:
  squid.i686 7:3.1.10-1.el6_2.4

Complete!

Step 3: Configure Squid

After installing Squid, you need to configure it to work correctly. The main configuration file for Squid is located at /etc/squid/squid.conf.

See also  How to Copy and Paste Text in one line With vi or vim in Linux

To open the configuration file, run the following command:

sudo vi /etc/squid/squid.conf

Inside the configuration file, you can set various options such as the listening port, cache size, and access controls. Make sure to save the changes once you’re done editing the file.

Step 4: Start and Enable Squid

Once Squid is configured, you can start and enable it to run automatically at boot time using the following command:

sudo systemctl start squid
sudo systemctl enable squid

You can verify that Squid is running by checking its status using the following command:

sudo systemctl status squid

For example:

[root@centos63 ~]# systemctl status squid
squid (pid  11806) is running...

Step 5: Configure Firewall

If you’re using a firewall on your system, you need to allow incoming connections to Squid. To do this, run the following command:

sudo firewall-cmd --add-service=squid --permanent
sudo firewall-cmd --reload

The above commands will allow incoming connections to Squid on the default port 3128.

See also  How to Change Default Apache "DocumentRoot" Directory in Linux (Ubuntu/CentOS)

Commands Mentioned:

  • yum – command-line package management utility for RPM-based Linux systems
  • systemctl – command-line tool to manage systemd services and units
  • firewall-cmd – command-line tool to manage firewall rules on RHEL-based systems
  • vi – command-line text editor

Conclusion:

In this guide, we have shown you how to install Squid on CentOS 6.3. We started by updating the system, then we installed Squid and configured it to work correctly. We also started and enabled Squid to run automatically at boot time and configured the firewall to allow incoming connections to Squid. By following these steps, you can set up Squid on your CentOS 6.3 system and improve your network performance, security, and privacy.

See also  How to Install Squid Proxy Server in Docker Containers

If you have any comments or suggestions, feel free to leave them below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *