Do-It-Yourself Caching: Squid 2.3 - page 2
Why Caching is Essential
Unless you bump into compile problems, installing Squid isn't all that difficult. We recommend starting with the Squid User's Guide. This Guide provides an excellent intro-level explanation. Once you begin to ask tougher questions, consult the Squid FAQ for additional detail.
We began with a pair of PCs already networked and running Apache. As suggested by the Guide, we created a new squid user account with home directory /usr/local/squid. (For security reasons, Squid should not be run as root.) After logging in as squid, we downloaded, unzipped, and extracted the source into/usr/local/squid/squid-2.3.STABLE1. We then invoked the following commands to compile and install Squid in the default location with an embedded SNMP agent:
These commands install Squid in /usr/local/squid with subdirectories /bin, /etc, /logs, and /cache.
You can start with the default config (etc/squid.conf), but it's worth taking a few minutes to consider where your cache storage will be located. If you change nothing, data will be stored in the /cache subdirectory created during installation. We replaced /cache with a separate 4 GB disk partition we'd created exclusively for cache storage. Though not strictly required, we suggest using dedicated partitions or disks for cache storage to facilitate tuning and compartmentalize "out of space" problems.
The default config allocates 100 MB disk space and 8 KB of RAM for cache storage. On our PIII 500, we modified squid.conf to use 3 GB of disk space and 32 KB of RAM. On our minimal P133, we tried several settings, but could not overcome stability problems that we attribute to insufficient memory. After making these changes to the cache_dir statement in squid.conf, execute the command:
to create swap directories that index stored data. If you change your mind later, you can always remove cached files and recreate (empty) swap directories in a different location, or add another cache_dir.
By default, Squid operates in proxy mode, listening for client requests sent to port 3128. If that's not what you want, you'll need to modify squid.conf (see "Deploying Squid" later in this tutorial). Otherwise, just execute squid again without the -z option to launch a background child process. View the file /usr/local/bin/logs/cache.log to see errors. Once you have Squid running as intended, you'll probably want to update your inittab, rc.local, or init.d file to launch Squid automatically at boot. It took us about 30 minutes to get Squid running in proxy mode during our first install.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates