Installing Squid 3.1 on CentOS 5.6 with SELinux

Since there are no official packages of Squid 3.1 for CentOS or RHEL, the only ways to install are compiling from source or via 3rd party rpm. My method may not be proper so if there are any glaring mistakes, please let me know. Alternate method via 3rd party Yum repository here.

1. Download the RPM from

yum install perl-DBI
rpm -ivh squid-3.1.8-1.el5.x86_64.rpm

2. At this point, add or change any settings in /etc/squid/squid.conf. Make sure to add visibile_hostname or squid will complain later.
3. Change owner to squid.

chown squid:squid /var/spool/squid
chown squid:squid /usr/local/squid

4. Initialize squid cache directory.

squid -z

5. Create SELinux policy.

setenforce 0
squid -d 1
setenforce 1
grep "AVC.*squid" /var/log/audit/audit.log|audit2allow -M squid
semodule -i squid.pp

5. Start squid.

service squid start
[root@rukia ~]# service squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]

If squid starts fine and users are still unable to connect, check firewall in iptables and confirm rules. In my case, I needed to add:

iptables -I RH-Firewall-1-INPUT -i eth0 -s -j ACCEPT

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

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