Chapter 1 squid Chinese authoritative guide

Source: Internet
Author: User
From: http://bbs.chinaunix.net/viewthread.php? Tid = 561403

Preface:
I have maintained several squid servers at work. I have read Duane Wessels (he is also the founder of squid) for many times. His original title is "Squid: the definitive guide ", published by o'reilly. I have translated it into Chinese in my spare time, hoping to help Chinese squid users. For common Internet users, squid can be used as a contemporary server, while squid acts as a Web Accelerator for large sites such as Sina and Netease. Both roles play exceptionally well. The open-source world is as beautiful as the stars, and squid is one of the dazzling stars.
Please contact me if you have any questions about this edition. My email is: yonghua_peng@yahoo.com.cn Peng Yonghua

Bytes --------------------------------------------------------------------------------------

Chapter 1 obtain squid

Version 2.1 and release

Squid developers regularly release source code. Each release version has a version number, for example, 2.5.stable4. The third part of the version number starts with stable or devel.

Maybe you can guess that the devel version tends to have newer and more experimental features. But maybe they have more buckets. Inexperienced users should not run the devel version. If you choose to run a devel version and encounter problems, report the problem to the squid maintainer.

After a period of development, the squid version is changed to stable. This version is suitable for common users. Of course, even the stable version may have some buckets. Higher stable versions (such as stable3 and stable4) should have fewer buckets. If you are particularly concerned about stability, you should use one of these latest versions.

2.2 Use source code
Why can't you copy a pre-compiled binary code to your system and expect it to run well? The main reason is that the squid code needs to know the parameters of a specific operating system. In fact, the most important parameter is the maximum number of opened file descriptors. Squid's./configure script detects these values before compilation. If you get a compiled squid that uses a specific parameter value to another system that uses different parameter values, you may encounter problems.

Another reason is that many Squid functions must be activated during compilation. If you get a compiled squid file that does not contain the required functions, You have to compile it again. Finally, shared libraries may make it difficult to share executable files between systems. The shared library is loaded at runtime, like a known dynamic link. Squid will detect some functions of the C library in your system during compilation (for example, whether they are provided or run ). Although library functions are not often changed, there may be significant differences between the C libraries of two different systems. If the differences between the two systems are too large, it will cause problems for squid.

It is very easy to obtain the squid source code. Visit the home page of squid: http://www.squid-cache.org. The home page has links to different stable versions and Development versions. If you are not in the United States, visit one of squid's many image sites. A mirror site is typically named "wwwN.CC.squid-cache.org", where n is a number and CC is the country's code. For example, www1.au.squid-cache.org is a mirror site in Australia and there is a link on the home page pointing to a different mirror site.

Each squid release Branch (such as Squid-2.5) has its own HTML page. This page has links to the source code, and the differences with other releases. If you upgrade from a release version to the next version, you should download these differential files and install patches. For more information, see section 3.7. The release page of each version describes new features and important improvements, and links to the corrected bugs.

If Web access is not feasible, you can get source code from the ftp://ftp.squid-cache.org's FTP server, or use another FTP image. To obtain the current version, visit the pub/squid-2/devel or pub/squid-2/stable directory. FTP images are also available in many countries, and you can use the same country code to guess some FTP image sites, such as ftp1.uk.squid-cache.org.

The current squid version is about 1 MB. After downloading the compressed package, you can continue with chapter 2.

2.3 Pre-compiled binary files

Some Unix release versions may pre-include the squid compilation version. For Linux systems, you can find the squid RPM package. Squid rpm is usually included in the Linux CD you bought. FreeBSD/NetBSD/OpenBSD also contains squid in their ports or packages.

Although RPM or precompiled packages can save you some time, they also have some drawbacks. As I mentioned, some functions must be activated or disabled before you start compiling squid. The pre-compiled package you install may not contain the specific features you want. In addition, the squid./configure script detects specific parameters in your system. These parameters in your system may be different from those on the machine that compiled it.

Finally, if you want to patch squid, you must wait for someone to compile the updated RPM or packages, or you have to find the source code for compilation.

I strongly recommend that you compile squid from the source code, of course, how to choose from you.

2.4 anonymous CVs

You can access squid's CVS file (read-only) anonymously to keep your source code updated synchronously. The advantage of using CVS is that you can easily obtain the current running version of the patch. This makes it easy to find out what has changed recently.

Apply these patches to the version you are running to effectively synchronize your source code with the official version.

CVS uses a tree index system. The trunk is called the head branch. For squid, this is where all new changes and new features are stored. The head branch usually contains experimental, maybe less stable code. Stable code is usually on other branches.

To effectively use squid's anonymous CVs, you should first know how versions and branches are marked differently. For example, Version 2.5 branch is named squid_2_5. The specific release has a long name, such as squid_2_5_stable4. To obtain squid 2.5.stable4, use the squid_2_5_stable4 label and use squid_2_5 to obtain the code of the nearest 2.5 branch.

To use the squid anonymous CVs service, you must first set the cvsroot environment variable:
CSH % setenv cvsroot: pserver: anoncvs@cvs.squid-cache.org:/squid,
Alternatively, for the Bourne shell User:
Sh $ cvsroot =: pserver: anoncvs@cvs.squid-cache.org:/squid
Sh $ export cvsroot

Then you can log on to the server:

% CVS Login
(Logging in to anoncvs@cvs.squid-cache.org)
CVS password:

At the prompt, type anoncvs as the password. Now you can use this command to check the source code tree:

% CVS checkout-r squid_2_5-D squid-2.5 squid

-R option specifies to obtain the revision tag. If the-r option is omitted, you will obtain the header branch.

-D option to change the top-level Directory Name of the stored file. If you omit the-D option, the top-level directory name is the same as the module name.

The final command line parameter (SQUID) is the name of the module to be checked.

Once you have checked the squid source code tree, you can run the CVS update command to upgrade your files and maintain file synchronization. Other Commands include CVS diff, CVS log, and CVS annotate.

For more information about CVs, visit: http://www.cvshome.org

2.5 devel.squid-cache.org

Squid developers maintain an independent site and are currently running on SourceForge, providing experimental Squid functions. Please check them at http://devel.squid-cache.org. Here you can find many projects under development that are not yet integrated into the official code of squid. You can access these projects through the anonymous CVs service of SourceForge, or download different files from the standard version.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.