Google Answers Logo
View Question
 
Q: Squid Proxy Server ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Squid Proxy Server
Category: Computers > Operating Systems
Asked by: osharpar-ga
List Price: $50.00
Posted: 26 Sep 2004 14:54 PDT
Expires: 26 Oct 2004 14:54 PDT
Question ID: 406603
Please I need a step by step procedure of how to configure squid in Redhat 9.0
Answer  
Subject: Re: Squid Proxy Server
Answered By: leapinglizard-ga on 27 Sep 2004 08:42 PDT
Rated:5 out of 5 stars
 
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

Request for Answer Clarification by osharpar-ga on 30 Sep 2004 22:09 PDT
Thanks for your answer. I am new to linux. In your statement "look for the
line containing it under the heading "Default:". Copy this line", i do
not know wether to erase the line containing default before i
uncomment the variable definition. Most importantly what is your email
address?

Clarification of Answer by leapinglizard-ga on 01 Oct 2004 07:50 PDT
The regulations of this service prohibit Researchers from contacting
clients outside the website, but I am pleased to offer you further
assistance right here. My work on this question does not end until you
are satisfied with the answer.

Do not erase the line that says Default. It is a comment that may
prove to be useful later. Just copy the line below it, the one with
the variable, and change the value(s) as required. You must delete the
# mark at the beginning of the new line, the one you have modified, to
change it from a comment into an active line. Do not delete or alter
any of the original comments.

leapinglizard
osharpar-ga rated this answer:5 out of 5 stars
Thank you for your answer. I have finally configured squid in my redhat 9.0

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy