CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

28.4. Compile and Optimize

Return into the new Squid directory and type the following commands on your terminal:

                 CC="egcs" \
                 CFLAGS="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions" \
                 ./configure \
                 --prefix=/usr \
                 --exec-prefix=/usr \
                 --bindir=/usr/sbin \
                 --libexecdir=/usr/lib/squid \
                 --localstatedir=/var \
                 --sysconfdir=/etc/squid \
                 --enable-delay-pools \
                 --enable-cache-digests \
                 --enable-poll \
                 --disable-ident-lookups \
                 --enable-truncate \
                 --enable-heap-replacement
               

This tells Squid to set itself up for this particular hardware setup with these options:

Now, we must compile and install Squid on the server:

                 [root@deep ]/squid-2.3.STABLE2# make -f  makefile
                 [root@deep ]/squid-2.3.STABLE2# make install
                 [root@deep ]/squid-2.3.STABLE2# mkdir -p /var/log/squid
                 [root@deep ]/squid-2.3.STABLE2# rm -rf /var/logs/
                 [root@deep ]/squid-2.3.STABLE2# chown squid.squid /var/log/squid/
                 [root@deep ]/squid-2.3.STABLE2# chmod 750 /var/log/squid/
                 [root@deep ]/squid-2.3.STABLE2# chmod 750 /cache/
                 [root@deep ]/squid-2.3.STABLE2# rm -f  /usr/sbin/RunCache
                 [root@deep ]/squid-2.3.STABLE2# rm -f  /usr/sbin/RunAccel
                 [root@deep ]/squid-2.3.STABLE2# strip /usr/sbin/squid
                 [root@deep ]/squid-2.3.STABLE2# strip /usr/sbin/client
                 [root@deep ]/squid-2.3.STABLE2# strip /usr/lib/squid/dnsserver
                 [root@deep ]/squid-2.3.STABLE2# strip /usr/lib/squid/unlinkd
                 [root@deep ]/squid-2.3.STABLE2# strip /usr/lib/squid/cachemgr.cgi
               

Take note that we remove the small scripts named RunCache and RunAccel which start Squid in either caching mode or accelerator mode, since we use a better script named squid located under the /etc/rc.d/init.d/ directory that takes advantage of Linux system V. The strip command will reduce the size of binaries for optimum performance.

Please do cleanup later:

                 [root@deep] /# cd /var/tmp
                 [root@deep ]/tmp# rm -rf squid-version/ squid-version.STABLEz-src.tar.gz
                 [root@deep ]/tmp# rm -rf malloc/ malloc.tar.gz (if you used the GNU malloc external library)
               
The rm command will remove all the source files we have used to compile and install Squid and GNU malloc. It will also remove the Squid and GNU malloc compressed archive from the /var/tmp directory.