日期:2014-05-16  浏览次数:20763 次

linux 服务器安装cutycapt,抓取网页快照
1、安装svn
yum install -y subversion

2、安装qt47

增加qt47的下载源  
#vi /etc/yum.repos.d/atrpms.repo  


输入如下内容
[atrpms]  
name=CentOS $releasever – $basearch – ATrpms  
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable  
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms  
gpgcheck=1  
enabled=1  
  
[atrpms-testing]  
name=CentOS $releasever – $basearch – ATrpms testing  
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/testing  
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms  
gpgcheck=1  
enabled=1  


安装qt47

#yum install -y qt47  
#yum install -y qt47-devel  

如果提示有冲突
yum remove libX11-1.0.3-11.el5.i386
再执行 yum install qt47-devel

继续安装如下两个工具  
#yum install -y qt47-webkit  
#yum install -y qt47-webkit-devel  

3、更新sqllite
yum update sqlite

4、更新/etc/profile,将下面代码加入profile中
export QTDIR=/usr/lib64/qt47
export QTLIB=/usr/lib64/qt47/lib
export QTINC=/usr/lib64/qt47/include
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export PATH=$QTDIR/bin:$PATH

4.1 刷新当前缓存
source /etc/profile

5、安装g++
yum install gcc gcc-c++

6、编译
cd /home/cloud/cutycapt/CutyCapt
qmake
make

7、安装xserver
yum groupinstall "X Window System" -y
如果遇到冲突 卸载冲突的包
yum remove libX11-1.1.3-4.el5.x86_64
此时会将刚才安装的qt47的包全删除掉
再重新安装qt47  yum install qt47*

8、安装server模拟环境
yum install -y Xvfb

9、下载模拟环境命令
wget http://www.flexthinker.com/wp-content/uploads/2009/11/xvfb-run.sh.txt 
mv ./xvfb-run.sh.txt ./xvfb-run.sh
chmod u+x ./xvfb-run.sh

10、安装中文字体

yum install -y fonts-chinese

11、执行测试
/home/cloud/cutycapt/CutyCapt/xvfb-run.sh /home/cloud/cutycapt/CutyCapt/CutyCapt --url=http://www.miercn.com/  --out=163.jpg 
出现错误:
CutyCapt: xcb_xlib.c:82:xcb_xlib_unlock: 断言“c->xlib.lock”失败。
执行 export LIBXCB_ALLOW_SLOPPY_LOCK=1
重新测试后成功生成图片, 将 export LIBXCB_ALLOW_SLOPPY_LOCK=1 更新至/etc/profile