File: FAQ-2.html

package info (click to toggle)
squid 1.1.21-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,828 kB
  • ctags: 3,705
  • sloc: ansic: 34,400; sh: 1,975; perl: 899; makefile: 559
file content (233 lines) | stat: -rw-r--r-- 7,183 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<HTML>
<HEAD>
<TITLE>SQUID Frequently Asked Questions: Installation</TITLE>
</HEAD>
<BODY>
<A HREF="FAQ-1.html">Previous</A>
<A HREF="FAQ-3.html">Next</A>
<A HREF="FAQ.html#toc2">Table of Contents</A>
<HR>
<H2><A NAME="s2">2. Installation</A></H2>

<H2><A NAME="ss2.1">2.1 Which file do I download to get Squid?</A></H2>

<P>You must download a source archive file of the form 
squid-x.y.z-src.tar.gz (eg, squid-1.1.6-src.tar.gz) from
<A HREF="http://squid.nlanr.net/Squid/">the Squid home page</A>, or.
<A HREF="ftp://squid.nlanr.net/pub/">the Squid FTP site</A>.
Context diffs are available for upgrading to new versions.
These can be applied with the <EM>patch</EM> program (available from
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">the GNU FTP site</A>).</P>


<H2><A NAME="ss2.2">2.2 How do I install Squid?</A></H2>

<P>First you will have to decompress and extract the source archive, by typing:
<PRE>
        % gzip -dc squid-x.y.z-src.tar.gz | tar xvf -
</PRE>

Next you will need to configure, compile, and install.
<PRE>
        % cd squid-x.y.z
        % ./configure
        % make all
        % make install
</PRE>
</P>

<P>Building Squid works best if you have the GNU C (gcc) 
compiler.  Recent versions have been converted to ANSI C, so
some older compilers may not work.  The GNU C compiler is
available at
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">the GNU FTP site</A>.
In addition to gcc, you may also want or need to install the <EM>binutils</EM>
package.</P>

<P>The configure script can take numerous options.  The most
useful is <CODE>--prefix</CODE> to install it in a different directory.
The default installation directory is <EM></EM>usr/local/squid/.  To
change the default, you could do:
<PRE>
        % cd squid-x.y.z
        % ./configure --prefix=/some/other/directory/squid
</PRE>
</P>


<H2><A NAME="ss2.3">2.3 What Operating Systems does Squid support?</A></H2>

<P>The software is designed to operate on any modern Unix system, and
is known to work on AIX, FreeBSD, HP-UX, IRIX, Linux, OSF/1, Solaris,
and SunOS. If you encounter any platform-specific problems, please
let us know by sending email to
<A HREF="mailto:squid-bugs@nlanr.net">squid-bugs</A>.</P>


<H2><A NAME="ss2.4">2.4 What does the <EM>squid.conf</EM> file do?</A></H2>

<P>The <EM>squid.conf</EM> file defines the configuration for
<EM>squid</EM>.  the configuration includes (but not limited to)
HTTP port number, the ICP request port number, incoming and outgoing
requests, information about firewall access, and various timeout
information.</P>


<H2><A NAME="ss2.5">2.5 Do you have a <EM>squid.conf</EM> example?</A></H2>

<P>Yes, after you <CODE>make install</CODE>, a sample <EM>squid.conf</EM> file will
exist in the ``etc" directory under the Squid installation directory.</P>
<P>The sample <EM>squid.conf</EM> file contains comments explaining each
option.</P>



<H2><A NAME="ss2.6">2.6 How do I start Squid?</A></H2>

<P>After you've finished editing the configuration file, you can 
start Squid for the first time.  The source distribution includes
a script called <EM>RunCache</EM> which makes sure the Squid process
is always running.  </P>

<P>With version 1.1.16 and later, you must first run Squid with the 
<B>-z</B> option to create the cache swap directories.
<PRE>
        % /usr/local/squid/bin/squid -z
</PRE>

Squid will exit when it finishes creating all of the directories.
Next you can start <EM>RunCache</EM>:
<PRE>
        % /usr/local/squid/bin/RunCache &
</PRE>
</P>

<P>For versions before 1.1.6 you sould just start <EM>RunCache</EM>
immediately, instead of running <EM>squid -z</EM> first.</P>


<H2><A NAME="ss2.7">2.7 How do I start Squid automatically when the system boots?</A></H2>

<H3>From inittab</H3>

<P>On systems which have an <EM>/etc/inittab</EM> file (Digital Unix,
Solaris, IRIX, HP-UX, Linux), you can add a line like this:
<PRE>
        sq:3:respawn:/usr/local/squid/bin/squid.sh &lt; /dev/null &gt;&gt; /tmp/squid.log 2&gt;&1
</PRE>

We recommend using a <EM>squid.sh</EM> shell script, but you could instead call
Squid directly.  A sameple <EM>squid.sh</EM> script is shown below:
<PRE>
        #!/bin/sh
        C=/usr/local/squid
        PATH=/usr/bin:$C/bin
        TZ=PST8PDT
        export PATH TZ

        notify=&quot;root&quot;
        cd $C
        umask 022
        sleep 10
        while [ -f /tmp/nosquid ]; do
                sleep 1
        done
        /usr/bin/tail -20 $C/logs/cache.log \
                | Mail -s &quot;Squid restart on `hostname` at `date`&quot; $notify
        exec bin/squid -CYs
</PRE>
</P>

<H3>From rc.local</H3>

<P>On BSD-ish systems, you will need to start Squid from the ``rc'' files,
usually <EM>/etc/rc.local</EM>.  For example:
<PRE>
        if [ -f /usr/local/squid/bin/RunCache ]; then
                echo -n ' Squid'
                (/usr/local/squid/bin/RunCache &)
        fi
</PRE>
</P>

<H3>From init.d</H3>

<P>Some people may want to use the ``init.d'' startup system.
If you start Squid (or RunCache) from an ``init.d'' script, then you
should probably use <EM>nohup</EM>, e.g.:
<PRE>
        nohup squid -sY $conf &gt;&gt; $logdir/squid.out 2&gt;&1
</PRE>

Also, you may need to add a line to trap certain signals
and prevent them from being sent to the Squid process. 
Add this line at the top of your script:
<PRE>
        trap '' 1 2 3 18
</PRE>
</P>


<H2><A NAME="ss2.8">2.8 How do I tell if Squid is running?</A></H2>

<P>You can use the <EM>client</EM> program:
<PRE>
        % client http://www.netscape.com/ &gt; test
</PRE>
</P>
<P>There are other command-line HTTP client programs available
as well.  Two that you may find useful are
<A HREF="ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/">wget</A>
and
<A HREF="ftp://ftp.pasteur.fr/pub/Network/echoping/">echoping</A>.</P>

<P>Another way is to use Squid itself to see if it can signal a running
Squid process:
<PRE>
        % squid -k check
</PRE>

And then check the shell's exit status variable.</P>

<P>Also, check the log files, most importantly the <EM>access.log</EM> and
<EM>cache.log</EM> files.</P>


<H2><A NAME="ss2.9">2.9 How do I apply a patch or a diff?</A></H2>

<P>You need the <CODE>patch</CODE> program.  You should probably duplicate the
entire directory structure before applying the patch.  For example, if
you are upgrading from squid-1.1.10 to 1.1.11, you would run
these commands:
<PRE>
        cd squid-1.1.10
        mkdir ../squid-1.1.11
        find . -depth -print | cpio -pdv ../squid-1.1.11
        cd ../squid-1.1.11
        patch &lt; /tmp/diff-1.1.10-1.1.11
</PRE>

After the patch has been applied, you must rebuild Squid from the
very beginning, i.e.:
<PRE>
        make realclean
        ./configure
        make
        make install
</PRE>

Note, In later distributions (Squid 1.2), 'realclean' has been changed
to 'distclean'.</P>

<P>If your <CODE>patch</CODE> program seems to complain or refuses to work,
you should get a more recent version, from the
<A HREF="ftp://ftp.gnu.ai.mit.edu/pub/gnu/">GNU FTP site</A>, for example.</P>



<HR>
<A HREF="FAQ-1.html">Previous</A>
<A HREF="FAQ-3.html">Next</A>
<A HREF="FAQ.html#toc2">Table of Contents</A>
</BODY>
</HTML>