美文网首页我爱编程
CentOS下安装phantomjs

CentOS下安装phantomjs

作者: 小和尚的藏经阁 | 来源:发表于2018-01-29 23:46 被阅读0次

phantomjs真强悍,不过官网的安装说明是真差劲,还是自己整理一份以备后用吧。
1 下载链接:
https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
下载解压到/usr/local/phantomjs目录下
(在本机用迅雷下载,然后上传到服务器,可以节约很多时间)

2 解压:

# tar jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2

3 确认版本,测试可用:

# cd /usr/local/phantomjs/bin
# ./phantomjs --version

如果出现以下错误:
./phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

则需要安装fontconfig:

yum -y install fontconfig

4 修改环境变量,随时随地执行phantomjs命令:

#vi /etc/profile

增加一行:
export PATH=/usr/local/phantomjs/bin:$PATH

相关文章

网友评论

    本文标题:CentOS下安装phantomjs

    本文链接:https://www.haomeiwen.com/subject/wwfqzxtx.html