Thursday, March 17, 2011

How to install Squid Proxy server on CentOS 5 Linux server

Squid proxy server is primarily designed to run on Linux / Unix-like type systems. Squid is known ad high-performance proxy caching server for http Web clients, it is compatible with HTTP FTP, gopher, and HTTP data objects. Unlike other traditional caching servers or software, Squid can handles all requests in a single, non-blocking, I/O-driven process. Squid keeps especially hot objects store in CACHE MEMORY, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of failed requests.

Install Squid proxy server on CentOS 5.X / RedHat 5

You can use yum command as follows for installing Squid Automatically from internet

# yum install squid


Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package squid.i386 7:2.6.STABLE6-4.el5 set to be updated
--> Running transaction check

Dependencies Resolved

 Package                 Arch       Version          Repository        Size
 squid                   i386       7:2.6.STABLE6-4.el5  updates           1.2 M

Transaction Summary
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)        

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: squid                        ######################### [1/1]

Installed: squid.i386 7:2.6.STABLE6-4.el5

Basic Configuration of Squid:

Configuration file of Squid located at /etc/squid/squid.conf. Edit this  file using a text editor:

# vi /etc/squid/squid.conf

At least you need to modify or define ACL (access control list) to work with squid. Squid defaults port is TCP 3128. Following example ACL allowing access from your local networks and with your network). Make sure your  Local network is same as mentioned above otherwise edit it you’re your requirement :

acl our_networks src 192.168.o.0/24
http_access allow our_networks

Save and close the file. Start squid proxy server:

# chkconfig squid on

# /etc/init.d/squid start


init_cache_dir /var/spool/squid... Starting squid: .       [  OK  ]

Verify port 3128 is open:

# netstat -tulpn | grep 3128


tcp        0      0      *                   LISTEN      2

Open TCP port 3128

Finally make sure iptables is allowing to access squid proxy server. Just open /etc/sysconfig/iptables file:

# vi /etc/sysconfig/iptables

Append configuration:

-A RH-Firewall-1-INPUT -m state --state NEW,ESTABLISHED,RELATED -m tcp -p tcp --dport 3128 -j ACCEPT

Restart iptables based firewall:

# /etc/init.d/iptables restart


Flushing firewall rules:                                   [  OK  ]

Setting chains to policy ACCEPT: filter                    [  OK  ]

Unloading iptables modules:                                [  OK  ]

Applying iptables firewall rules:                          [  OK  ]

Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]

Client configuration

Open a webbrowser > Tools > Internet option > Network settings > and setup Squid server IP address and port # 3128.

No comments:

Post a Comment

Linux Basic and Advance Videos