Dear osharpar,
Squid is a proxy web server that caches recently accessed content for
fast repeated access. If you are not interested in this functionality,
you probably don't need squid.
Step 0: Install
My own Red Hat 9.0 installation already includes squid. If yours doesn't,
you'll want to install the squid-2.5 RPM from disc 1 of the Red Hat 9.0
distribution. Load the disc into your CD-ROM drive and switch to root
using the su command. If your CD-ROM drive mounts under /mnt/cdrom,
you'll have the following dialogue.
> su
Password:
# rpm -ivh /mnt/cdrom/RedHat/RPMS/squid-2.5.STABLE1-2.i386.rpm
warning: /mnt/cdrom/RedHat/RPMS/squid-2.5.STABLE1-2.i386.rpm: V3 DSA
signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:squid ########################################### [100%]
#
Leave root mode by typing Ctrl-D.
Step 1: Prepare
The squid configuration file is now located at /etc/squid/squid.conf .
You can look it over as an ordinary user, but to edit it, you'll have
to be root. Most of the variables will not be relevant to you, but you
should at least review the following ones. Search for each variable
name with your favorite word processor -- I use vim -- and look for the
line containing it under the heading "Default:". Copy this line, then
uncomment the variable definition by removing the '#' character. Now
you can change the value to suit your needs.
cache_mem
This is the amount of RAM you can spare for the cache alone,
but Squid will use about three times this amount in total. Since
I can spare 100 megabytes for Squid, I set cache_mem to 33 megs.
cache_mem 33 MB
cache_dir
The first argument here is the type of file system used for the
cache, which you should leave at the default value of ufs. The
second argument is the directory where the cache will be
stored. I suggest you switch to root mode and make a directory
called /var/local/squid , then change its owner to a non-root
user. My username is mike, so I execute the following.
# mkdir /var/local/squid
# sudo chown mike:mike /var/local/squid
If you have lots of hard disk space, you can set the third
argument to 250 or 500. Otherwise, leave the numbers as they are.
cache_dir ufs /var/local/squid/cache 100 16 256
error_directory
Squid can output informative error messages if you set this
properly. In the case of a Red Hat 9.0 installation, the error
messages should be in /usr/share/squid/errors/English .
error_directory /usr/share/squid/errors/English
pid_filename
This is the name of a small file where Squid writes its process
ID. Since you probably want to run Squid as a non-root user for
safety, you should first make a file as root in the /var/run
directory, then change its owner to yourself.
# echo 0 > /var/run/squid.pid
# chown mike:mike /var/run/squid.pid
pid_filename /var/run/squid.pid
To make sure you haven't made any syntax errors in modifying the
configuration file, run "squid -k parse". If there is no output,
everything is fine.
Step 2: Execute
You must now run squid several times. First, run it with the -z option
to set up the cache directories.
> squid -z
2004/09/27 11:27:55| Creating Swap Directories
Now run it in debug mode to make sure it's working fine.
> squid -NCd1
You should get lots of output from that, including a line that reads
"Ready to serve requests."
From another terminal window, test the squid server by running squidclient
on a few websites.
> squidclient http://google.com
HTTP/1.0 302 Moved Temporarily
Location: ://www.google.com/
Set-Cookie:
PREF=ID=66dda52c53fe2384:TM=1096298999:LM=1096298999:S=1A9RwweQxPXhFEUg;
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
Content-Type: text/html
Server: GWS/2.1
Content-Length: 152
Date: Mon, 27 Sep 2004 15:29:59 GMT
X-Cache: MISS from pegasus.somethingisaid.com
Proxy-Connection: close
<HTML><HEAD><TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="://www.google.com/">here</A>.
</BODY></HTML>
To stop the squid server, type Ctrl-C in the terminal from which
you launched it. To run squid in silent mode, execute it without any
command-line options. You can now confirm that it is running by searching
for its name among the active processes.
> squid
> ps -A | grep squid
14635 ? 00:00:00 squid
14637 ? 00:00:00 squid
If these steps don't work as I've described them and you're quite sure
you've followed my instructions to the letter, get back to me so I can
help you debug.
There is an extensive FAQ at the following address. In reading it,
you should not assume that every configuration detail applies to you,
since you have an older, RPM-based installation of the Squid package.
SQUID Frequently Asked Questions
http://www.squid-cache.org/Doc/FAQ/FAQ.html
If you feel that my answer is incomplete or inaccurate in any way, please
post a clarification request so that I have a chance to meet your needs
before you assign a rating.
Regards,
leapinglizard |