信息化
新闻日历
图片新闻
苹果iPad预订热潮暴涨 人数超当年iPhone
自iPad可以预定以来,顾客对iPad的热情持续高涨。市调...
2010/02/24
奢侈品:侧滑全键盘WM智能手机阿玛尼三星B7620
手机经过十几年的发展已经摆脱了当初笨重、难看的标签...
2010/02/22
Alienware前高管造Origin高端游戏悍本(图)
近日,Origin公司推出了一款游戏笔记本,型号为Eon18。...
2010/02/22
虚幻引擎3驾临iPhone 3GS
近日,Epic Games的副总裁Mark Rein展示了点儿新鲜玩意...
2009/12/23
分析评论
中国移动难逃山寨机杯具:Ophone乃下下签
我认为标准的建立应该按照以下逻辑推动。上策,完全自...
2010/02/01
Twitter网友热论苹果平板电脑 iPad名字遭嘲讽
苹果CEO史蒂夫·乔布斯(Steve Jobs)一揭开iPad的神秘...
2010/01/28

用DNSPod和Squid打造自己的CDN(六)




作者: Dnspod
CNETNews.com.cn
2008-05-24 21:32:40
关键词: 编译 CDN 服务器 SQUID DNS

  第 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="$"

  然后通过export命令设置

  export CHOST="i686-pc-linux-gnu"

  export CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

  export CXXFLAGS="$"

  设置完成后,我们可以通过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。

用户评论

  • 用户名
  • 评论内容