系统环境:CentOS 6.5  Squid 3.0                内网网段:10.211.55.0/24                Squid服务器地址:10.211.55.4 (端口是3128)                客户端地址: 10.211.55.9                              网  关:10.211.55.1使用源码包编译安装安装源码包必备参数集./configure --prefix=/usr/local/squid --sysconfdir=/usr/local/squid/etc --bindir=/usr/local/squid/bin --sbindir=/usr/local/squid/sbin --mandir=/usr/local/squid/share/man --enable-gnuregex --enable-carp --enable-async-io=80 --enable-removal-policies=heap,lru --enable-icmp --enable-delay-pools --enable-useragent-log --enable-referer-log --enable-kill-parent-hack --enable-snmp --enable-arp-acl --enable-htcp --enable-cache-digests --enable-default-err-language=Simplify_Chinese --enable-err-languages="Simplify_Chinese" --enable-poll --enable-linux-netfilter --disable-ident-lookups --enable-underscores --enable-auth="basic" --enable-basic-auth-helpers="NCSA" --enable-external-acl-helpers="ip_user" --enable-x-accelerator-varymake && make install-----------------------------------------------------------------------------创建管理组和用户groupadd squiduseradd squid -g  squidchown -R squid:squid /usr/local/squid/varchomd -R 775 /usr/local/squid/var-----------------------------------------------------------------------------修改Squid配置文件 Squid.conf根据实际需求设定相关参数1,初始化你在 squid.conf 里配置的 cache 目录#/usr/local/squid/sbin/squid -z //初始化缓存空间如果有错误提示,请检查你的 cache目录的权限。2,对你的squid.conf 排错,即验证 squid.conf 的 语法和配置。#/usr/local/squid/sbin/squid -k parse如果squid.conf 有语法或配置错误,这里会返回提示你,如果没有返回,恭喜,可以尝试启动squid。-----------------------------------------------------------------------------启停Squid服务1.在前台启动squid,并输出启动过程。#/usr/local/squid/sbin/squid -N -d1如果有到 ready to server reques,恭喜,启动成功。然后 ctrl + c,停止squid,并以后台运行的方式启动它。2,启动squid在后台运行。#/usr/local/squid/sbin/squid -s这时候可以 ps -A 来查看系统进程,可以看到俩个 squid 进程。3,停止 squid发出关闭信号,等会话结束后彻底关闭/usr/local/squid/sbin/squid -k shutdown关闭squid(更高优先级,直接关闭squid)/usr/local/squid/sbin/squid -k interrupt关闭squid(最高优先级,直接杀死squid进程)/usr/local/squid/sbin/squid -k kill重新读取遍squid配置文件/usr/local/squid/sbin/squid -k reconfigure-----------------------------------------------------------------------------squid3.0 需要手动创建cache目录后在执行下述操作/usr/local/squid/sbin/squid -zX/usr/local/squid/sbin/squid -N -d1-----------------------------------------------------------------------------查看squid的日志和进程,看squid运行是否正常代码如下:ps -ef |awk '/^squid/'cat /data/squidlog/cache.log/usr/local/squid/sbin/squid -k check ;echo $?滚动日志文件/usr/local/squid/sbin/squid -k rotate设置每周二凌晨四点30分自动滚动日志echo "30 4 * * 2 root /usr/local/squid/sbin/squid -k rotate " >>/etc/crontab