How to Setup Squid Proxy Service on CentOS 5.9

In this guide, we’ll walk you through the process of setting up a Squid Proxy Server on CentOS 5.9.

Squid is a caching proxy server for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

This tutorial will cover the basic installation and configuration of Squid and how to deploy web filtering applications to save bandwidth and speed up web access.

Step 1: Installing Squid Proxy Server

The first step in setting up a Squid Proxy Server on CentOS 5.9 is to install the Squid package. This can be done by issuing the following command:

[root@centos59 ~]# yum -y install squid

This command will install the Squid package along with its dependencies. The “-y” option in the command allows yum to proceed with the installation without asking for confirmation.

Example:

[root@centos59 ~]# yum -y install squid
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nus.edu.sg
 * extras: mirror.nus.edu.sg
 * updates: mirror.nus.edu.sg
base                                                                         | 1.1 kB     00:00
extras                                                                       | 2.1 kB     00:00
updates                                                                      | 1.9 kB     00:00
updates/primary_db                                                           | 103 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package squid.i386 7:2.6.STABLE21-6.el5 set to be updated
--> Processing Dependency: perl(URI::URL) for package: squid
--> Running transaction check
---> Package perl-URI.noarch 0:1.35-3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package              Arch               Version                             Repository        Size
====================================================================================================
Installing:
 squid                i386               7:2.6.STABLE21-6.el5                base             1.3 M
Installing for dependencies:
 perl-URI             noarch             1.35-3                              base             116 k

Transaction Summary
====================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 1.4 M
Downloading Packages:
(1/2): perl-URI-1.35-3.noarch.rpm                                            | 116 kB     00:00
(2/2): squid-2.6.STABLE21-6.el5.i386.rpm                                     | 1.3 MB     00:11
----------------------------------------------------------------------------------------------------
Total                                                               111 kB/s | 1.4 MB     00:12
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-URI                                                                     1/2
  Installing     : squid                                                                        2/2

Installed:
  squid.i386 7:2.6.STABLE21-6.el5

Dependency Installed:
  perl-URI.noarch 0:1.35-3

Complete!

Step 2: Configuring Squid

Once the Squid package is installed, the next step is to configure it. This involves editing the main Squid configuration file. You can use the ‘vi’ editor to do this. Here are the configurations you need to set:

See also  How to Disable iptables on Linux CentOS 5.7 Server

Define the allowed network:

acl webhostinggeeks-dev3 src 192.168.2.0/24

Allow the defined network:

http_access allow webhostinggeeks-dev3

Set the port that Squid listens to (default is 3128):

http_port 3128

Set the visible hostname:

visible_hostname centos59.webhostinggeeks-dev3.local

Step 3: Starting Squid Service

After configuring Squid, the next step is to start the Squid service. This can be done by issuing the following command:

[root@centos59 ~]# service squid start

This command will start the Squid service. If the service starts successfully, you should see an “[ OK ]” message.

[root@centos59 ~]# service squid start
Starting squid: .                                          [  OK  ]

Commands Mentioned

  • yum -y install squid – This command installs the Squid package along with its dependencies.
  • service squid start – This command starts the Squid service.
See also  How to Configure NFS Client on Linux

Conclusion

Setting up a Squid Proxy Server on CentOS 5.9 is a straightforward process that involves installing the Squid package, configuring it, and starting the service.

This guide has provided step-by-step instructions on how to do this. By following these steps, you can set up a Squid Proxy Server to help reduce bandwidth usage, speed up web access, and cache web, name server query, and other network lookups.

FAQ

  1. What is Squid used for?

    Squid is primarily used as a proxy and caching agent for HTTP, HTTPS, and FTP protocols. It helps in reducing bandwidth usage and improving response times by caching and reusing frequently-requested web pages.

  2. How do I install Squid on CentOS 5.9?

    You can install Squid on CentOS 5.9 by using the command ‘yum -y install squid’. This command will install the Squid package along with its dependencies.

  3. How do I configure Squid on CentOS 5.9?

    You can configure Squid on CentOS 5.9 by editing the main Squid configuration file. This involves defining the allowed network, allowing the defined network, setting the port that Squid listens to, and setting the visible hostname.

  4. How do I start the Squid service on CentOS 5.9?

    You can start the Squid service on CentOS 5.9 by using the command ‘service squid start’. This command will start the Squid service.

  5. What are the benefits of using a Squid Proxy Server?

    A Squid Proxy Server can help in reducing bandwidth usage and improving response times by caching and reusing frequently-requested web pages. It can also be used to speed up a web server by caching repeated requests, and for caching web, name server query, and other network lookups.

Comments

Leave a Reply

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