How to Setup Squid Proxy Server on Linux CentOS 6.3

In server optimization, Squid plays two primary roles:

  • acts as a caching proxy server, standing between the user and the web, thereby enhancing the efficiency and speed of web requests;
  • serves as a content accelerator or reverse proxy, intercepting requests to a server and using a cached version of the page to serve the request.

This tutorial will guide you through the process of setting up a Squid 3 Proxy Server on CentOS 6.3.

For a deeper understanding of web servers, you can explore our comprehensive guides on the best web servers. If you’re interested in other server types like Apache, Nginx, or LiteSpeed, we’ve got you covered.

Step 1: Install Squid

The first step in setting up a Squid Proxy Server on CentOS 6.3 is to install Squid. This can be done using the ‘yum install’ command as shown below:

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

This command will install Squid on your CentOS 6.3 system.

[root@centos63 ~]# yum install squid -y
Loaded plugins: fastestmirror, presto, priorities
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
CentOS6.3-Repository                                                         | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package squid.i686 7:3.1.10-9.el6_3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package             Arch               Version                         Repository             Size
====================================================================================================
Installing:
 squid               i686               7:3.1.10-9.el6_3                updates               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
squid-3.1.10-9.el6_3.i686.rpm                                                | 1.7 MB     00:14
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 7:squid-3.1.10-9.el6_3.i686                                                      1/1
  Verifying  : 7:squid-3.1.10-9.el6_3.i686                                                      1/1

Installed:
  squid.i686 7:3.1.10-9.el6_3

Complete!

Step 2: Configure Squid Configuration File

Next, you need to configure the main Squid configuration file. You can use the ‘vi’ command to edit the file:

[root@centos63 ~]# vi /etc/squid/squid.conf

Step 3: Add Internal Network Name

In this step, you will add your internal network name into the IP networks list where browsing should be allowed. For instance, if your internal network name is ‘ehowstuff’, you would add it as shown below:

acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl ehowstuff src 192.168.1.0/24 # Your internal network

Step 4: Allow Browsing for Your Network

Next, you need to add your network (in this case, ‘ehowstuff’) to the ACL section list of IP networks where browsing should be allowed:

http_access allow localnet
http_access allow localhost
http_access allow ehowstuff

Step 5: Set Squid Proxy Port

Ensure that the Squid proxy port is uncommented. You can change the proxy port to any available port. By default, Squid listens to port 3128:

http_port 3128

Step 6: Start Squid Service

Now that Squid is configured, you can start the Squid service using the following command:

[root@centos63 ~]#service squid start

You should see a response indicating that the Squid service has started successfully.

See also  How to Enable the root Login on Ubuntu 11.10

Step 7: Configure Proxy Setting at Client’s Browser

The final step is to configure the proxy setting at the client’s browser. This process will vary depending on the browser you are using, but you will need to enter the IP address of your Squid server and the port number (3128 by default) into your browser’s proxy settings.

Squid server settings

Commands Mentioned

  • yum install squid -y – This command installs Squid on your CentOS 6.3 system.
  • vi /etc/squid/squid.conf – This command opens the main Squid configuration file for editing.
  • service squid start – This command starts the Squid service.
See also  How to Configure Squid Proxy Server for Transparent Proxying

Conclusion

Setting up a Squid Proxy on CentOS 6.3 is a straightforward process that involves installing Squid, configuring the main Squid configuration file, adding your internal network name, allowing browsing for your network, setting the Squid proxy port, starting the Squid service, and configuring the proxy setting at the client’s browser.

By following the steps outlined in this tutorial, you can successfully set up a Squid Proxy Server and enhance the efficiency and speed of your web requests. Remember, if you need more information on web servers, you can always refer to our guides on the best web servers, Apache, Nginx, and LiteSpeed.

See also  How to Configure Squid Proxy Server for HTTPS Filtering

For different types of hosting, you can explore our articles on dedicated server, VPS server, cloud hosting, and shared hosting.

Remember, the key to a successful web server setup lies in understanding the process and following the steps carefully.

Happy hosting!

FAQ

  1. What is a Squid Proxy Server?

    A Squid Proxy Server is a tool that primarily acts as a caching proxy server, standing between the user and the web, thereby enhancing the efficiency and speed of web requests. Additionally, it serves as a content accelerator or reverse proxy, intercepting requests to a server and using a cached version of the page to serve the request.

  2. What is the purpose of the ‘yum install squid -y’ command?

    The ‘yum install squid -y’ command is used to install Squid on your CentOS 6.3 system.

  3. What does the ‘service squid start’ command do?

    The ‘service squid start’ command is used to start the Squid service on your system.

  4. What is the default port for Squid?

    The default port for Squid is 3128.

  5. How do I configure the proxy setting on my client’s browser?

    The process will vary depending on the browser you are using, but you will need to enter the IP address of your Squid server and the port number (3128 by default) into your browser’s proxy settings.

Comments

1 Comment

Leave a Reply

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