squid基本安装运行
星期一, 十二月 5th, 20051、下载一个可编译的稳定版本,目前版本应为2.5
ftp://www.squid-cache.org/pub/squid-2/STABLE/
2、安装squid-2.5.STABLE5.tar.gz
% tar xzf squid-2.5.STABLE5.tar.gz
% cd squid-2.5.STABLE5
% ./configure –prefix=/usr/local/squid
% make
% make install
附configure options
–prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/squid]
–enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea
–enable-gnuregex Compile GNUregex
–enable-splaytree Use SPLAY trees to store ACL lists
–enable-xmalloc-debug Do some simple malloc debugging
–enable-xmalloc-debug-trace
Detailed trace of memory allocations
–enable-xmalloc-statistics
Show malloc statistics in status page
–enable-carp Enable CARP support
–enable-async-io Do ASYNC disk I/O using threads
–enable-icmp Enable ICMP pinging
–enable-delay-pools Enable delay pools to limit bandwith usage
–enable-mem-gen-trace Do trace of memory stuff
–enable-useragent-log Enable logging of User-Agent header
–enable-kill-parent-hack
Kill parent on shutdown
–enable-snmp Enable SNMP monitoring
–enable-cachemgr-hostname[=hostname]
Make cachemgr.cgi default to this host
–enable-arp-acl Enable use of ARP ACL lists (ether address)
–enable-htpc Enable HTCP protocol
–enable-forw-via-db Enable Forw/Via database
–enable-cache-digests Use Cache Digests
see http://www.squid-cache.org/Doc/FAQ/FAQ-16.html
–enable-err-language=lang
Select language for Error pages (see errors dir)
3、现在squid安装在/usr/local/squid下
要启动需编辑etc/squid.conf文件
cache_effective_user=squid
cache_effective_group=squid
然后将/usr/local/squid/var/logs目录分配给squid用户
% chown squid.squid -R /usr/local/squid/var/logs
4、创建swap空间
% /usr/local/squid/sbin/squid -z
5、检查配置
% /usr/local/squid/sbin/squid -k parse
如果没有任何提示则表明配置无误。
6、启动
调试模式:
% /usr/local/squid/sbin/squid -NCd1
服务模式
% /usr/local/squid/sbin/squid
7、关闭
% /usr/local/squid/sbin/squid -k shutdown
附录,squid 命令参数
Specify an alternate port number for incoming HTTP requests. Useful for testing a configuration file on a non-standard port.
Debugging level for “stderr” messages. If you use this option, then debugging messages up to the specified level will also be written to stderr.
Specify an alternate squid.conf file instead of the pathname compiled into the executable.
Prints the usage and help message.
Sends a HUP signal, which causes Squid to re-read its configuration files.
Sends an USR1 signal, which causes Squid to rotate its log files. Note, if logfile_rotate is set to zero, Squid still closes and re-opens all log files.
Sends a TERM signal, which causes Squid to wait briefly for current connections to finish and then exit. The amount of time to wait is specified with shutdown_lifetime.
Sends an INT signal, which causes Squid to shutdown immediately, without waiting for current connections.
Sends a KILL signal, which causes the Squid process to exit immediately, without closing any connections or log files. Use this only as a last resort.
Sends an USR2 signal, which causes Squid to generate full debugging messages until the next USR2 signal is recieved. Obviously very useful for debugging problems.
Sends a “ZERO” signal to the Squid process. This simply checks whether or not the process is actually running.
Send debugging (level 0 only) message to syslog.
Specify an alternate port number for ICP messages. Useful for testing a configuration file on a non-standard port.
Prints the Squid version.
Creates disk swap directories. You must use this option when installing Squid for the first time, or when you add or modify the cache_dir configuration.
Do not make initial DNS tests. Normally, Squid looks up some well-known DNS hostnames to ensure that your DNS name resolution service is working properly.
If the swap.state logs are clean, then the cache is rebuilt in the “foreground” before any requests are served. This will decrease the time required to rebuild the cache, but HTTP requests will not be satisified during this time.
Do not automatically become a background daemon process.
Do not set the SO_REUSEADDR option on sockets.
Enable virtual host support for the httpd-accelerator mode. This is identical to writing httpd_accel_host virtual in the config file.
Enable full debugging while parsing the config file.
Return ICP_OP_MISS_NOFETCH instead of ICP_OP_MISS while the swap.state file is being read. If your cache has mostly child caches which use ICP, this will allow your cache to rebuild faster.