Welcome to this demo clip, setting up Squid.
In this clip, you'll see how to download Squid,
how to build Squid from source, and how to start Squid using Docker.
Let's get started.
So first things first, you'll want to head over to Squid's website,
squid‑cache.org. From here, you can click on the Download button.
This takes you to Squid's download page from which you can download
every available version of Squid.
You'll want to grab the latest stable version of Squid here. From
this page, we can go ahead and download the source code. If you don't
want to build from source, binaries are available for a number of
different distributions. Now that we have the source code, let's see
how we can build Squid from source so that we can begin to use it. In
this course,
we've selected to use Docker in order to make
building and running Squid very easy.
Let's take a look at our Dockerfile. We'll be using a stable version of
Ubuntu as our operating system and base image here.
Now we set some environment variables including the
SQUID_VERSION, and a bit further down, the caching and log
directories that Squid will use. Here, we copy in the
downloaded source code that we grabbed earlier.
Now here are the really important bits.
First, we install the needed dependencies to build Squid.
As you can see, we need to C/C++ compiler, in this case, gcc and make.
Now, we need to run the configure script found within the Squid source
code to prepare Squid for building. The configure script has a number of
different options that we can take advantage of when it comes to
customizing your specific build of Squid.
And finally, we run make install to install Squid. For a full listing of
instructions on how to build Squid on several different operating
systems and for a listing of available options,
check out this URL. Now, we can set the script we want to run on startup
and expose the port that we would like Squid to run on.
If we check out this entrypoint.sh file really quickly, we
can see that it simply starts Squid, passing in the path to
the appropriate squid.conf file.
Now we can run docker build to build the image.
This may take a while if it's your first time running this command, as Squid
is being built from source and it's a rather large project.
Once that's complete,
we can run a container based on this new image we've created. And as you
can see, Squid is running within this container. Awesome.
This is a start. In the next demo,
we'll actually learn about how to configure Squid, an important step if
we're going to learn how to take advantage of the different
authentication and access controls that Squid provides.