{channel.title!channel.name} - 楚淮公司周东林

Linux安装squid

Squid可运行在大多数Unix和OS/2版本的系统之上,已知的可工作的有: Windows,AIX,Digital Unix,FreeBSD,HP-UX,Irix,Linux,NetBSD,Nextstep,SCO,Solaris


1.下载squid源码安装包

wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.3.tar.gz

2.安装依赖包

yum install gcc* ;

yum -y install gcc-*

3.安装squid

解压缩

tar zxvf squid-3.2.3.tar.gz

进入解压后的目录

cd squid-3.2.3(目录位置依据个人设定而不同)

安装

[root@localhost squid-3.2.3]# ./configure --prefix=/usr/local/squid --enable-gnuregex --enable-icmp --enable-linux-netfilter --enable-default-err-language="Simplify_Chinese" --enable-kill-parent-hack --enable-cache-digests --enable-dlmalloc --enable-poll --enable-async-io=240 --enable-delay-pools --with-filedescriptors=65536 --enable-snmp --enable-arp-acl --mandir=/usr/share/man/ --with-large-files

[root@localhost squid-3.2.3]#make && make install

************************************************************************************************************

chmod 777 /usr/local/squid/var

chmod 777 /usr/local/squid/var/logs

/usr/local/squid/sbin/squid -z  #重新建立缓存

/usr/local/squid/sbin/squid -k parse # 测试配置文件

/usr/local/squid/sbin/squid -k reconfigure  #重新配置文件

/usr/local/squid/sbin/squid -k shutdown  #关闭squid

/usr/local/squid/sbin/squid -s #后台开启squid

/usr/local/squid/sbin/squid -N -d1 #前台开启squid

/usr/local/squid/sbin/squid -k interrupt  #关闭squid(更高优先级,直接关闭squid)

/usr/local/squid/sbin/squid -k kill  #关闭squid(最高优先级,直接杀死squid进程)
 

4.设置squid自启动

echo "/usr/local/squid/sbin/squid -s " >>/etc/rc.local

设置每周二凌晨两点25分自动滚动日志

echo "25 2 * * 2 root /usr/local/squid/sbin/squid -k rotate " >>/etc/crontab


浏览.发表于:2016-11-01 10:15:06