|
|
|
![]() |
|||||
Download Site http://www.squid-cache.org/ Docs http://squid-docs.sourceforge.net/latest/html/book1.htm |
|||||
Earlier we looked at the tree structure of the /usr/local/squid directory. I suggest extracting the Squid source to the /usr/local/squid/src directory. So, create the directory and copy
the downloaded Squid tar.gz file into it. First let's decompress the file. Some versions of tar can decompress the file in one step, but for compatability's sake we are going to do it in two steps. Decompress the tar file by
running gzip -dv squid-version.tar.gz. If all has gone well you should have a file called squid-version.tar in the current directory. To get the files out of the "tarball", run tar xvf squid-version.tar. Tar
automatically puts the files into a subdirectory: something like squid-2.1.PRE2. Change into the extracted directory, and we can start configuring the Squid source. Squid features are enabled (or disabled) with the configure shell
script. Some Squid features have to be specifically enabled when Squid is compiled, which can mean that you have to recompile at a later stage. There are two reasons that a feature can be disabled by default:
Operating system Compatibility. Although Squid is written in as generic a way possible, certain functions (such as async-io, transparency and ARP-based access control lists) are not available on all operating systems. When many
operating systems cannot use a feature, it is included as a compile time option. Efficiency. On a very lightly loaded cache, async-io can actually slow down requests minutely. Some system administrators may wish to disable
certain features to speed up their caches. You may be wondering why there simply aren't config file options for these less used features. For most of the features there really isn't a reason other than (?minimalisim?). Why have
code sitting in the executable that isn't actually used? You can include the features that you might use at some time in the future without detrimental effects (other than a slightly larger binary), so as to avoid having to
recompile the Squid source later on. The configure program also has a second function: with some source code you have to edit a header file which tell the compiler which function calls to use on the system. This very often makes
source compilation difficult. With Squid, however, the GNU configure script checks what programs, libraries and function calls are available on your system. This simplifies setup dramatically. To make configure as generic as
possible, it's actually a Bourne Shell /bin/sh script. If you have replaced your /bin/sh shell with a less Posix-capable shell (like ash) you may not be able to run configure. If this is the case you will have to change the first
line of the configure script to run the full shell. all source inclusion options are set with the command './configure option'. On most systems root doesn't have a '.' in their search path for security reasons, so you have to
fully specify the path to the binary (hence the '/'). To turn more than one configuration option on at once you simply append each option to the end of the command line. You can, for example, change the prefix install directory
and turn Async-IO on with a command like the following (more on what each of these options is for shortly).
./configure --prefix=/usr/people/staff/oskar/squid --enable-async-io
Note that only the commonly used configuration options are included here. To get a complete list of options you can run './configure --help'. Many of the resulting options are standard to the GNU configure script that Squid
uses, and are used for some things like cross compilation. If you wish to find out about some of the more obscure options you may have to ask someone on one of the relevant mailing lists, or even read the source code!
The make command creates the binary, but doesn't install it. Running make install creates the /usr/local/squid/bin and /usr/local/squid/etc subdirectories, and copies the binaries and default config files in the appropriate
directories. Permissions may not be set correctly, but we will work through all created directories and set them up correctly shortly. This command also copies the relevant config files into the default directories. The standard
config file included with the source is placed in the etc subdirectory, as are the mime.types file and the default Squid MIB file (squid.mib). If you are upgrading (or reinstalling), make install will overwrite binary files in
the bin directory, but will not overwrite your painfully manipulated configuration files. If the destination configuration file exists, make install will instead create a file called filename.default. This allows you to check if
useful options have been added by comparing config files. If all has gone well you should have a fully installed (but unconfigured) Squid system setup.
|
|||||
|
|||||