Squid-Cache Proxy Server on Red Hat (CentOS) Distributions

From Kathmann Labs

Jump to: navigation, search

[edit] Squid-Cache Proxy Server on Red Hat (CentOS) Distributions How-to

NOTE: These are instructions for CentOS, a Red Hat clone. Replace the "yum" command with "up2date" if you are actually using Red Hat.

Install Red Hat / CentOS linux

Install CentOS to a VM

Install Squid cache

  • yum install squid - installs squid on your machine

Configure Squid cache

  • vi /etc/squid/squid.conf
  • uncomment and change the http_port line to http_port 8080 - you can use any port you want, TCP/8080 is the standard web proxy port
  • add a line to represent your local network (or all networks you want this proxy server to handle) to the ACCESS CONTROLS section of the config file
  • acl kllocal src 192.168.0.0/255.255.255.0 - this would create an entry called kllocal with the source address being anything in the Class C network 192.168.0.0
  • to keep in best practice, you can name each acl as a site's name. Such as acl boston src 10.0.1.0/255.255.255.0 (Site's location is Boston, address space is Class C network 10.0.1.0
  • search for the "http_access deny all" string by typing in ESC then /http_access deny all - this should bring you to that line
  • add the following before that line - http_access allow kllocal (or the acl name you created)

Add ports to firewall

  • vi /etc/sysconfig/iptables - add the following lines
  • -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

Enable Squid on startup

  • chkconfig --levels 2345 squid on - turns on squid for automatic start on boot in runlevels 2,3,4, and 5

Start the daemon (and restart iptables)

  • /etc/init.d/iptables restart - restarts the iptables daemon and reloads the changes made above
  • /etc/init.d/squid start - starts the squid daemons
Personal tools
extras