You must download a source archive file of the form squid-x.y.z-src.tar.gz (eg, squid-1.1.6-src.tar.gz) from the Squid home page, or. the Squid FTP site. Context diffs are available for upgrading to new versions. These can be applied with the patch program (available from the GNU FTP site).
First you will have to decompress and extract the source archive, by typing:
% gzip -dc squid-x.y.z-src.tar.gz | tar xvf -
Next you will need to configure, compile, and install.
% cd squid-x.y.z
% ./configure
% make all
% make install
Building Squid works best if you have the GNU C (gcc) compiler. Recent versions have been converted to ANSI C, so some older compilers may not work. The GNU C compiler is available at the GNU FTP site. In addition to gcc, you may also want or need to install the binutils package.
The configure script can take numerous options. The most
useful is --prefix to install it in a different directory.
The default installation directory is usr/local/squid/. To
change the default, you could do:
% cd squid-x.y.z
% ./configure --prefix=/some/other/directory/squid
The software is designed to operate on any modern Unix system, and is known to work on AIX, FreeBSD, HP-UX, IRIX, Linux, OSF/1, Solaris, and SunOS. If you encounter any platform-specific problems, please let us know by sending email to squid-bugs.
The squid.conf file defines the configuration for squid. the configuration includes (but not limited to) HTTP port number, the ICP request port number, incoming and outgoing requests, information about firewall access, and various timeout information.
Yes, after you make install, a sample squid.conf file will
exist in the ``etc" directory under the Squid installation directory.
The sample squid.conf file contains comments explaining each option.
After you've finished editing the configuration file, you can start Squid for the first time. The source distribution includes a script called RunCache which makes sure the Squid process is always running.
With version 1.1.16 and later, you must first run Squid with the -z option to create the cache swap directories.
% /usr/local/squid/bin/squid -z
Squid will exit when it finishes creating all of the directories.
Next you can start RunCache:
% /usr/local/squid/bin/RunCache &
For versions before 1.1.6 you sould just start RunCache immediately, instead of running squid -z first.
On systems which have an /etc/inittab file (Digital Unix, Solaris, IRIX, HP-UX, Linux), you can add a line like this:
sq:3:respawn:/usr/local/squid/bin/squid.sh < /dev/null >> /tmp/squid.log 2>&1
We recommend using a squid.sh shell script, but you could instead call
Squid directly. A sameple squid.sh script is shown below:
#!/bin/sh
C=/usr/local/squid
PATH=/usr/bin:$C/bin
TZ=PST8PDT
export PATH TZ
notify="root"
cd $C
umask 022
sleep 10
while [ -f /tmp/nosquid ]; do
sleep 1
done
/usr/bin/tail -20 $C/logs/cache.log \
| Mail -s "Squid restart on `hostname` at `date`" $notify
exec bin/squid -CYs
On BSD-ish systems, you will need to start Squid from the ``rc'' files, usually /etc/rc.local. For example:
if [ -f /usr/local/squid/bin/RunCache ]; then
echo -n ' Squid'
(/usr/local/squid/bin/RunCache &)
fi
Some people may want to use the ``init.d'' startup system. If you start Squid (or RunCache) from an ``init.d'' script, then you should probably use nohup, e.g.:
nohup squid -sY $conf >> $logdir/squid.out 2>&1
Also, you may need to add a line to trap certain signals
and prevent them from being sent to the Squid process.
Add this line at the top of your script:
trap '' 1 2 3 18
You can use the client program:
% client http://www.netscape.com/ > test
There are other command-line HTTP client programs available as well. Two that you may find useful are wget and echoping.
Another way is to use Squid itself to see if it can signal a running Squid process:
% squid -k check
And then check the shell's exit status variable.
Also, check the log files, most importantly the access.log and cache.log files.
You need the patch program. You should probably duplicate the
entire directory structure before applying the patch. For example, if
you are upgrading from squid-1.1.10 to 1.1.11, you would run
these commands:
cd squid-1.1.10
mkdir ../squid-1.1.11
find . -depth -print | cpio -pdv ../squid-1.1.11
cd ../squid-1.1.11
patch < /tmp/diff-1.1.10-1.1.11
After the patch has been applied, you must rebuild Squid from the
very beginning, i.e.:
make realclean
./configure
make
make install
Note, In later distributions (Squid 1.2), 'realclean' has been changed
to 'distclean'.
If your patch program seems to complain or refuses to work,
you should get a more recent version, from the
GNU FTP site, for example.