Minggu, 04 April 2010
This article will discuss how to install a web proxy with squid cache to be urgently needed by an institution that is connected to the internet
This article will discuss how to install a web proxy with squid cache to be urgently needed by an institution that is connected to the internet (eg internet cafe).
The author is very grateful to Gerhard mas that have made the book placed online on the internet, and of course to the Squid team who has made a remarkable reply software. Note: - Installation by this method has been successfully performed on the system RH6.2, RH7.0, RH7.1 and RH7.2 - Squid that has been used is squid-2.4.STABLE1-src.tar.gz and squid-2.4.STABLE4-src.tar.gz, squid-2.4.STABLE6-src.tar.gz o> Preparation: Download the files needed for installation and optimization yg squid in the directory you like (eg / var / tmp): - Squid-2.4.STABLE6-src.tar.gz (can be found at www.squid-cache.org) - Malloc.tar.gz (can be found at http://debian.web.id/download/lib/malloc.tar.gz) - Floppy.tgz (can be found at http://debian.web.id/download/systool/floppy.tgz) o> installation steps: Squid Configuration and Optimization ------------------------------- - Squid results ekstraklah file d / l an # Tar zxvf squid-2.4.STABLE6-src.tar.gz - Squid proxy server can not run as super user root, therefore, create a user who will run the squid: # Useradd-d / cache /-r-s / dev / null squid> / dev / null 2> & 1 # Mkdir / cache / ---- you do not need to type this command if you have created your / cache at the time of first installation of linux. # Chown-R squid.squid / cache / - Edit the file icons / Makefile.in with a text editor you like and change the line: DEFAULT_ICON_DIR = $ (sysconfdir) / icons becomes: DEFAULT_ICON_DIR = $ (libexecdir) / icons - Edit the file src / Makefile.in with a text editor you like and change the line: DEFAULT_CACHE_LOG = $ (localstatedir) / logs / cache.log becomes: DEFAULT_CACHE_LOG = $ (localstatedir) / log / squid / cache.log DEFAULT_ACCESS_LOG = $ (localstatedir) / logs / access.log becomes: DEFAULT_ACCESS_LOG = $ (localstatedir) / log / squid / access.log DEFAULT_STORE_LOG = $ (localstatedir) / logs / store.log becomes: DEFAULT_STORE_LOG = $ (localstatedir) / log / squid / store.log DEFAULT_PID_FILE = $ (localstatedir) / logs / squid.pid becomes: DEFAULT_PID_FILE = $ (localstatedir) / run / squid.pid DEFAULT_SWAP_DIR = $ (localstatedir) / cache becomes: DEFAULT_SWAP_DIR = / cache DEFAULT_ICON_DIR = $ (sysconfdir) / icons becomes: DEFAULT_ICON_DIR = $ (libexecdir) / icons The purpose of editing the file above is Untk change the default location of the file cache.log, access.log, and store.log to be placed in the directory / var / log / squid, and put the pid (process identification) squid in the directory / var / run, and save the icons directory in / usr / lib / squid / icons. Using GNU malloc library to improve cache performance of Squid -------------------------------------------------- ----------------------- - Copy malloc.tar.gz to the directory / var / tmp Malloc.tar.gz # cp / var / tmp - Extract and compile malloc # Cd / var / tmp # Tar zxvf malloc.tar.gz # Cd malloc # Export CC = egcs # Make - Copy libraries compiled results malloc (libmalloc.a) to the lib directory of your linux Libmalloc.a # cp / usr / lib / libgnumalloc.a - Copy the file malloc.h malloc compilation into system directories include your linux # Cp malloc.h / usr / include / gnumalloc.h Squid Compile and Optimize ---------------------------- - Go back to the directory where there is source squid # Cd / var/tmp/squid-2.4.STABLE6 - Type the following command on your computer: CC = "egcs" . / configure - prefix = / usr - exec-prefix = / usr - bindir = / usr / sbin - libexecdir = / usr / lib / squid - localstatedir = / var - sysconfdir = / etc / squid - enable-delay-pools - enable-cache-digests - enable-poll - disable-ident-lookups - enable-truncate Command-command mentioned above will mean very much if you read the help file provided:) (just type. / Configure - help) - Now we do the compilation and installation of squid, just type the following command-command on your linux: # Make-f makefile # Make install # Mkdir-p / var / log / squid # Rm-rf / var / logs / Squid.squid chown / var / log / squid / # Chmod 750 / var / log / squid / # Chmod 750 / cache / # Rm-f / usr / sbin / RunCache # Rm-f / usr / sbin / RunAccel # Strip / usr / sbin / squid # Strip / usr / sbin / client # Strip / usr / lib / squid / unlinkd # Strip / usr / lib / squid / cachemgr.cgi Using scripts available on the file floppy.tgz -------------------------------------------------- ----- - Extract files floppy.tgz (eg to / var / tmp) # Tar zxvf floppy.tgz - Copy script2 requisite by squid into the appropriate directory # Cd / var / tmp / floppy # Cp / var / tmp / floppy / Squid / init.d / squid / etc / rc.d / init.d / # Cp / var / tmp / floppy / Squid / logrotate.d / squid / etc / logrotate.d / Squid configuration file editing ------------------------------- - Edit supernal squid.conf file in the directory / etc / squid / reply with a text editor you like (eg vi, pico, joe, or mcedit) # Vi / etc / squid / squid.conf In this article I will discuss all the options available on squid.conf, I will only discuss the option-option is deemed necessary to run the squid and influential in the optimization squid. http_port 3128 This option will determine how many squid port will run (usually on port 3128 and 8080) icp_port 0 This option will determine how many squid through the port will send and receive requests from the proxy cache ICP neighbors. cache_mem 32 MB This option determines how much memory to be used by the squid, the default is the default is 8 MB is suitable for use in many systems. But if you have excess memory, it is advisable to increase it. Some argue that this value obtained from a third free memory for squid. cache_dir ufs / cache 1600 4 256 Cache_dir option to specify what kind of storage system that will be used (UFS), the name of the directory where the cache (/ cache), the size disk in megabytes that is used by the directory where the cache (1600 Mbytes), the number of subdirectories that will be the first filed under / cache (4), and the amount of the second subdirectory will be created in a subdirectory under the first one (256). Value2 the cache_dir option had to be adjusted with the system you have, usually have to be adjusted only cache storage, disk size, and the number of subdirectories that will be made. Angka2 about it, can we get from formulas that have been provided by Mas Devshed for optimization as follows: 1. Use 80% or less of each directory cache capacity that we have prepared. If we set our cache_dir size exceeds this value, then we will be able to see the performance decrease squid. 2. To determine the number of subdirectories to be created first, can use this formula: x = Size of cache dir in KB (ie 6GB = ~ 6,000,000 KB) y = Average object size (just use 13KB) z = number of subdirectories first = (((x / y) / 256) / 256) * 2 = # directory For example, I use the example of 6 GB for / cache (after it set aside 80%), then: 6,000,000 / 13 = 461538.5 / 256 = 1802.9 / 256 = 7 * 2 = 14 the cache_dir line would look like this: cache_dir ufs 6000 14 256 cache_store_log none This option will melog every activity of the storage manager. This log will show where the objects are removed from the cache, and which objects are stored and for a long brp object is stored. Because usually there's no point to analyze this data, it is advisable for the disabled. 2 minutes negative_ttl Default of this option is 5 minutes, but Mas Moh. J. Kabir suggested that reduced to 2 and, if possible, to 1 minute. Why settingannya like that? Mas Moh. J. Kabir explained that we want our proxy as transparent as possible. If a user searches the web pages that he was sure that there is, then we would not want any lag time between the URL into the world and the ability of users to access them. cache_effective_user squid cache_effective_group squid If the squid cache is run as root, the user who will run it will be changed according to the UID / GID to user option mentioned above. In the example above option if Squid is run by root, then the squid cache will run with the UID / GID squid. maximum_object_size 1024 KB With this option, the maximum file size is stored by the Squid cache could be limited. In other words, objects larger than these numbers would not disaved into the disk that has been set aside for the cache (eg / cache). 4 KB minimum_object_size With this option then the object is smaller than the numbers would not be mentioned in the disk disaved already been set aside for the cache. No additional articles written by Jay that Mas minimum file size is aimed at effecting dicache where filesystem is usually ext2 formatted with 4 KB inode. ftp_user hari@huhui.com With this option, then when the clients access the anonymous ftp site, email address above will be sent as a password for anonymous ftp server. 1 month reference_age With this option, then the cache files that have never accessed again during the above parameter values, will be automatically deleted by squid. src 192.168.1.0/255.255.255.0 acl PazzNET http_access allow PazzNET http_access deny all Option-option determines which subnet can access the Squid proxy. If there are several subnets, we can add a definition of his acl. cache_mgr hari@huhui.com Email-address of local cache manager who will receive an email when the cache is precisely mati.Email that will appear on the browser client if an error occurs when accessing a website via proxy squid. visible_hostname hari.huhui.com This information is sent as a footer at the time the error message appears on the screen the client browser. half_closed_clients off Some clients may cancel its TCP connection, allowing the penerimaaannya open. Squid sometimes can not distinguish between TCP connections are half-closed and full-closed. By default, half-closed connections remain open until the reading and writing on the socket raises an error. Change this value to off, then the squid with will immediately close the client connection if no data is read again. Suggestion other Devshed Mas to improve performance: cache_swap_high 100% cache_swap_low 80% When all was done, you try to start squid and taste the difference:) # / Etc / rc.d / init.d / squid start If there are errors, do not panic, just find where the mistake of always monitoring the log # Tail-f / var / log / messages If there are errors, berdo'alah, and ask forum2 linux on your kota2 or in # Indolinux of course:) ~ Further development of optimization squid: - Use the ReiserFS filesystem on a partition cache directory - Use a 7200 RPM UDMA 66 drives or fast (7200 or 10k RPM) SCSI drives with the patch drives.Tweak Andre Hedrick's Unified IDE patch. - Increase RAM
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar