您的位置:首页 > 运维架构 > 反向代理

centos5.4 64位系统安装部署squid

2011-03-24 14:42 525 查看
昨天接到个任务,要求部署一台squid服务器,因公司代理系统都是32位,而idc机房却给装了个64位centos,郁闷到极点,几经尝试,终于部署好了。

具体系统环境部署,我这里就不累赘了。

首先安装google-perftools,使用TCMalloc,与标准的glibc库的malloc相比,TCMalloc在内存的分配上效率和速度要高得多,可以在很大程度上提高服务器在高并发情况下的性能,降低系统负载。

由于google-perftools需要libunwind,到http://nongnu.askapache.com/libunwind/下载最新版本的libunwind。到http://google-perftools.googlecode.com下载最新版本的google-perftools。

开始安装部署:

1、安装libunwind

#tar -xzvf libunwind-0.99.tar.gz

#cd libunwind-0.99

#CFLAGS=-fPIC ./configure

#make CFLAGS=-fPIC

#make CFLAGS=-fPIC install

2、安装google-perftools

#tar -xzvf google-perftools-1.5.tar.gz

#cd google-perftools-1.5

#./configure

#make

#make install

3、运行如下命令:

#echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf

#ldconfig

注意:此步不操作,安装时会提示:“make[1]: *** [cf_parser.h] error 127”这个错误。

4、安装squid

# tar xvzf squid-2.7.STABLE9.tar.gz

#cd squid-2.7.STABLE9

#./configure --prefix=/usr/local/squid --enable-removal-policies=heap,lru --enable-linux-netfilter --enable-storeio=ufs,aufs,diskd,null --enable-epoll --enable-ident-lookups --enable-carp --enable-delay-pools --disable-wccp --disable-wccpv2 --enable-snmp --enable-cachemgr-hostname=squid --enable-cache-digests --with-pthreads --enable-gnuregex --with-aio --enable-large-cache-files --with-maxfd=344800 --enable-async-io=160 --enable-internal-dns --enable-linux-netfilter --enable-kill-parent-hack --enable-default-err-language="Simplify_Chinese"

#cd src

#vi Makefile

找到如下地方:

squid_LDADD = \

-L../lib \

\

在下面增加一行,变成如下:

squid_LDADD = \

-L../lib \

-ltcmalloc \

\

找到如下地方:

LDADD = -L../lib -lmiscutil -lrt -lpthread -lm

修改为:LDADD = -L../lib -lmiscutil -lrt -lpthread -lm -ltcmalloc

#make

#make install

至此squid部署完成。

注意点:64位系统下部署squid,刚开始我使用squid-2.6.STABLE22.tar.gz,编译过程提示netfilter透明代理啥的失败,make过程全是错误,后来又换了个squid-2.6.STABLE23.tar.gz版本,编译还是提示错误,make也是一大堆错误,网上资料也说不清楚到底是哪里的错误。后来换成2.7的稳定版本9,再次尝试,编译正确,make有错误,后来把--enable-removal-policies=“heap,lru”这个的双引号去掉,重新编译后make正常。总算解决一大难题啊。
本文出自 “我的运维之路” 博客,请务必保留此出处http://newyue.blog.51cto.com/174760/525187
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: