第 6 章 编译并安装Squid
首先使用tar把源代码压缩包解压
tar zxvf squid-2.6.STABLE13.tar.gz
解压后,我们得到一个名为 squid-2.6.STABLE13 的目录。进入目录
cd squid-2.6.STABLE13
在configure前,我们必须要先设置cflags,这里我们假设CPU是intel core duo的,cpu family 6,model 14。通过 http://gentoo-wiki.com/Safe_Cflags#Intel_Core_Solo.2FDuo 可以找到对应的优化参数
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
然后通过export命令设置
export CHOST="i686-pc-linux-gnu"
export CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
export CXXFLAGS="${CFLAGS}"
设置完成后,我们可以通过env命令来查看是否设置成功。
然后,我们开始configure源代码。使用下面的命令,把squid安装到/usr/local/squid目录中去。
./configure --prefix=/usr/local/squid --enable-follow-x-forwarded-for --enable-storeio=aufs,ufs --with-maxfd=65536 --with-pthreads --enable-dlmalloc --enable-poll --enable-stacktraces --enable-removal-policies=heap,lru --enable-delay-pools
对应参数的作用可以使用./configure --help得到。
这里大家要注意下,configure前面还有一个./,这个代表当前目录。意思是当前目录下面的configure文件。linux如果要执行当前目录的文件,必须要加上./。如果要执行当前目录下的下级目录里面的文件,可以不用加,比如bin/run。当然,./bin/run也是一样的效果。
接着我们会看到屏幕向下翻滚,出现一大堆checking for …的字样。一直等到下面的文字出现,并且停止,那么configure就算完成了。
config.status: creating tools/Makefile
config.status: creating include/autoconf.h
config.status: executing depfiles commands
[root@cnc squid-2.6.STABLE13]#
然后,我们输入make编译源代码,又是一行行的英文翻滚。是否有点感觉做黑客的味道?我们要做的还是继续等待下面的文字出现
make[2]: Leaving directory `/root/squid-2.6.STABLE13/tools'
make[1]: Leaving directory `/root/squid-2.6.STABLE13/tools'
make[1]: Entering directory `/root/squid-2.6.STABLE13'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/root/squid-2.6.STABLE13'
[root@cnc squid-2.6.STABLE13]#
这样源代码就算编译完成了。然后我们运行make install安装,等待下面的提示
make[2]: Leaving directory `/root/squid-2.6.STABLE13'
make[1]: Leaving directory `/root/squid-2.6.STABLE13'
[root@cnc squid-2.6.STABLE13]#
这里要注意:如果任何一个步骤出现带有error之类的警告,那么就是编译出错,需要检查到底是什么步骤出现问题并且改正。如果严格按照本文来编译,一般是不会出现错误的。另外,cflags参数使用不当同样会造成编译错误。
如果出现编译错误,必须要先make clean,然后重新make。(如果错误是在configure这步就不需要了)
到这里,squid就算是编译安装完毕了。我们可以到/usr/local/squid目录看看,里面已经躺着一大堆文件了。
[root@cnc squid-2.6.STABLE13]# cd /usr/local/squid
[root@cnc squid]# ls -lh
total 72K
drwxr-xr-x 2 root root 4.0K Jul 7 02:27 bin
drwxr-xr-x 2 root root 4.0K Jul 7 02:27 etc
drwxr-xr-x 2 root root 4.0K Jul 7 02:27 libexec
drwx------ 2 root root 16K Jun 15 08:09 lost+found
drwxr-xr-x 3 root root 4.0K Jul 7 02:27 man
drwxr-xr-x 2 root root 4.0K Jul 7 02:25 sbin
drwxr-xr-x 4 root root 4.0K Jul 7 02:25 share
drwxr-xr-x 3 root root 4.0K Jul 7 02:25 var
[root@cnc squid]#
接着我们要做的是配置squid。
DNSPod,Squid,CDN
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 【小提琴】陈立新《思乡曲》2004[FLAC+CUE]
- 《战地》新作明年初大规模测试!EA已内部测试一年
- 《GTAOL》PC版时隔多年更新反作弊!小助手宣布跑路
- EA称AI是其业务核心!能提高开发效率、节约成本
- 卫华.1990-太阳升【BMG】【WAV+CUE】
- 呼吸乐队.1992-THEBREATHING【深飞】【WAV+CUE】
- 李玟.2008-1994-2008豪华典藏精选2CD【SONY】【WAV+CUE】
- 《张学友 再现歌神的光辉岁月 梦想成真 2CD》[WAV/分轨][1.2GB]
- 《海来阿木 高音测试王》[WAV+CUE][500MB]
- 《许巍 歌声给你生命的力量 珍藏许巍 3CD》[WAV/分轨][2GB]
- 《直到黎明重制版》配置要求推荐
- 《赛博朋克2077》2.13版本更新内容一览
- 《神话时代:重述版》评测:粉丝们的朝花夕拾
- 战锤40K星际战士2先锋职业介绍|先锋职业技能效果一览
- 战锤40K星际战士2重装职业介绍|重装职业技能效果一览