Squid 安装
先建立一个新使用者 squid,所属群组也是
squid,安装 squid 时我们使用 squid 身分安装,并建立 Cache 目录结构。
以 squid 身分安装 squid
# cd /tmp
# tar zxvf squid-2.5.STABLE7.tar.gz
解压缩
z:处理*.tar.gz的档案
x:还原原先档案形式
v:压缩或解压所时显示路径和档案名称
f:指定档名
# chown -R squid:squid squid-2.5.STABLE3
变换 squid source 的拥有者及群组
# su - squid //切换成 squid
$ cd /tmp/squid-2.5.STABLE7
$ ./configure --prefix=/home/squid --enable-gnuregx \
--enable-dlmalloc --enable-poll \
--enable-err-language="Traditional_Chinese" \
--enable-default-err-language=Traditional_Chinese \
--enable-kill-parent-hack --enable-cache-digests \
--disable-ident-lookups \
--enable-removal-policies=heap \
--enable-storeio=diskd,ufs \
--enable-cachemgr-hostname="abc.ks.edu.tw" \
--enable-snmp --disable-unlinkd --enable-truncate \
--enable-stacktraces --disable-internal-dns
设定安装环境,制作 Makefile, \ 接续断行指令
叁数 说明
--prefix=/home/squid
指定安装目录。
--enable-gnuregx
Squid大量使用字串处理作各种判断,因此必须使用更好的 regex lib,
推荐使用 GNU 的 GNUregex lib,因其和 squid 相容,且在预设的
squid 原始码中即有,不需额外下载。
--enable-dlmalloc
Squid 为了快速反应 Client 端,在传达档案时是利用 RAM 中所建立的
硬碟索引表,因此常常会做 Memory Allocate & Free 的动作,所以
Memory Lib 的效能对 Proxy Server 整体效能影响非常大,而 DL-Malloc
是一种有效率的系统记忆体。
--enable-poll
用 poll() 取代预设的 select(),一般说来 poll 会比 select 表现更
完美,但因 poll 无法使用於某些平台,所以预设的的是 selsct,但仍
建议使用 poll。
--enable-storeio=diskd,ufs
使用 Diskd,这是新加入的 Disk I/O 处理动作,可以分别处理 Disk I/O
动作。详细说明:
http://www.squid-cache.org/Doc/FAQ/FAQ-22.html
--enable-default-err-language=Traditional_Chinese
default Error Page Language
--enable-err-language="Traditional_Chinese"
选择 Error Page 的语言。
--enable-kill-parent-hack Kill
parent on shutdown,在关掉squid时,连同parent process一起关掉;当 Squid 挂点时,parent process(RunCache)会
自动重跑 Squid,加入此叁数,可完全停掉 Squid,不会自动重跑。
--enable-cache-digests
Use Cache Digests,使用 cache 摘要表,为 Proxy Server 间沟通的
方式,详细情形可叁考:
http://www.squid-cache.org/Doc/FAQ/FAQ-16.html
--disable-ident-lookups
This allows you to remove code that performs Ident (RFC 931) lookups.
--enable-removal-policies=heap
使用各种 cache 的替代规则系统,取代标准的 LRU 规则系统。
--enable-cachemgr-hostname="abc.ks.edu.tw"
将 cachemgr.cgi 预设为此 host。
--enable-snmp
可以透过 snmp 利用 MRTG 来统计相关资料
--disable-unlinkd
Do not use unlinkd
--enable-truncate
This uses truncate() instead of unlink() when
removing cache files. Truncate gives a little
performance improvement, but may cause problems
when used with async I/O. Truncate uses more
filesystem inodes than unlink..
--enable-stacktraces
Enable automatic call backtrace on fatal errors
--disable-internal-dns
可以产生多个 DNS 的 child,增快解析网域名称的速度。
$ ./configure --help|more(可看各叁数英文说明)
$ make all(编译)
$ make install(安装)