Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

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:

  • Use the delay pools feature of Squid to limit and control bandwidth usage for users.

  • Use Cache Digests to improve client response time and network utilization.

  • Enable poll() instead of select() since its preferred over select.

  • Disable ident-lookups to remove code that performs Ident, RFC 931, lookups and reduce possible denial-of-service.

  • Enable truncate to glean some performance improvements when removing cached files.

  • Use the heap-replacement feature of Squid to have the choice of various cache replacement algorithms, instead of the standard LRU algorithm for better performance. See below for a more detailed explanation.

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
               

  • The make -f command will compile all source files into executable binaries

  • The make install will install the binaries and any supporting files into the appropriate locations.

  • The mkdir command will create a new directory named squid under /var/log.

  • The rm -rf command will remove the /var/logs directory since this directory has been created to handle the log files related to Squid that we have moved to the /var/log/squid location.

  • The chown will change the owner of /var/log/squid to be the user squid

  • The chmod command will make the mode of squid and cache directories; 0750/drwxr-x---, for security reasons.

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.

 
 
  Published under the terms of the Open Publication License Design by Interspire