1.下載程序文件
相關(guān)依賴
sudo yum -y install gcc gcc-c++ make flex bison gperf ruby openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel
下載并處理相關(guān)文件
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 (64位)
2.解壓文件
tar.bz2文件需要安裝安裝bzip2的依賴
yum install bzip2
bunzip2 phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -xvf phantomjs-2.1.1-linux-x86_64.tar
-xvf 等價(jià)于-x –v –f
圖片.png
–--將程序移到一個合適的位置
sudo mv phantomjs-2.1.1-linux-x86_64 /usr/local/src/phantomjs
—-創(chuàng)建軟鏈接到環(huán)境變量中遣耍。這樣可以直接在shell中使用phantomjs命令
sudo ln -sf 當(dāng)前路徑/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
—-檢查是否正常工作
在$PATH /usr/local/bin目錄下產(chǎn)生一個超鏈接phantomjs,鏈接的源文件產(chǎn)生自/usr/local/src/phantomjs/bin/phantomjs這個文件
phantomjs
>>>有時(shí)候在root路徑下權(quán)限不夠要把 .log文件的生成路徑放到/home目錄下然后再引用。
效果如圖:
image.png