How to Install Squid (Caching / Proxy) on Ubuntu 14.04 LTS

Squid is a caching and forwarding web proxy. It is most often used in conjunction with a traditional LAMP stack (Linux, Apache, MySQL, PHP), and can be used to filter traffic on HTTP, FTP, and HTTPS, and increase the speed (thus lower the response time) for a web server via caching.

Pre-Flight Check
  • These instructions are intended specifically for installing Squid on a single Ubuntu 14.04 LTS node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Step #1 Install Squid

As a matter of best practice we’ll update our packages:

apt-get update

Then let’s install Squid and any required packages:

apt-get install squid

Step #2: Verify and Checking the Version of the Squid the Installation

Squid should start immediately after the installation. Use the following command to view information on the command:

squid3 -h

Use the following command to check the version number of Squid and the configuration options it was started with:

squid3 -v

Your results should appear similar to:

Squid Cache: Version 3.3.8
Ubuntu
configure options: ‘–build=x86_64-linux-gnu’ ‘–prefix=/usr’ ‘–includedir=${prefix}/include’ ‘–mandir=${prefix}/share/man’ ‘–infodir=${prefix}/share/info’ ‘–sysconfdir=/etc’ ‘–localstatedir=/var’ ‘–libexecdir=${prefix}/lib/squid3’ ‘–srcdir=.’ ‘–disable-maintainer-mode’ ‘–disable-dependency-tracking’ ‘–disable-silent-rules’ ‘–datadir=/usr/share/squid3’ ‘–sysconfdir=/etc/squid3’ ‘–mandir=/usr/share/man’ ‘–enable-inline’ ‘–enable-async-io=8’ ‘–enable-storeio=ufs,aufs,diskd,rock’ ‘–enable-removal-policies=lru,heap’ ‘–enable-delay-pools’ ‘–enable-cache-digests’ ‘–enable-underscores’ ‘–enable-icap-client’ ‘–enable-follow-x-forwarded-for’ ‘–enable-auth-basic=DB,fake,getpwnam,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB’ ‘–enable-auth-digest=file,LDAP’ ‘–enable-auth-negotiate=kerberos,wrapper’ ‘–enable-auth-ntlm=fake,smb_lm’ ‘–enable-external-acl-helpers=file_userip,kerberos_ldap_group,LDAP_group,session,SQL_session,unix_group,wbinfo_group’ ‘–enable-url-rewrite-helpers=fake’ ‘–enable-eui’ ‘–enable-esi’ ‘–enable-icmp’ ‘–enable-zph-qos’ ‘–enable-ecap’ ‘–disable-translation’ ‘–with-swapdir=/var/spool/squid3’ ‘–with-logdir=/var/log/squid3’ ‘–with-pidfile=/var/run/squid3.pid’ ‘–with-filedescriptors=65536’ ‘–with-large-files’ ‘–with-default-user=proxy’ ‘–enable-linux-netfilter’ ‘build_alias=x86_64-linux-gnu’ ‘CFLAGS=-g -O2 -fPIE -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall’ ‘LDFLAGS=-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now’ ‘CPPFLAGS=-D_FORTIFY_SOURCE=2’ ‘CXXFLAGS=-g -O2 -fPIE -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security’

Step #3: Will Squid Start at Boot?

Yes!

initctl show-config squid3

You should receive a result similar to:

squid3
start on runlevel [2345]
stop on runlevel [!2345]

This means that Squid will start on runlevels 2, 3, 4, and 5.

For more information on Linux runlevels, visit our tutorial on: Linux Runlevels Explained

Be Sociable, Share!
Here's $75, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support.