ubuntu下安裝PhantomJS
1.下載:
- 32位:wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
- 64位:wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
2.解壓:
- 32 位:tar -xvf phantomjs-2.1.1-linux-i686.tar.bz2
- 64 位:tar -xvf phantomjs-2.1.1-linux-x86_64.tar.bz2
3.移動文件
- sudo mv phantomjs-2.1.1-linux-x86_64.tar.bz2 /usr/local/src/phantomjs
4.安裝相關依賴:
- sudo apt-get install build-essential chrpath libssl-dev libxft-dev libfreetype6-dev libfreetype6 libfontconfig1-dev libfontconfig1 -y
5.設置環境變量:
- sudo ln -sf /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
6.驗證安裝
- 在控制台輸入 phantomjs -v
ubuntu下安裝chrome
1.下載:
-
1 sudo apt-get install libxss1 libappindicator1 libindicator7 2 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 3 sudo dpkg -i google-chrome*.deb # Might show "errors", fixed by next line 4 sudo apt-get install -f 5 google-chrome --version # 查看版本
2.下載chromedriver:
- https://npm.taobao.org/mirrors/chromedriver
- 選擇對應的瀏覽器版本,下載對應的chromedriver
- 解壓,上傳到服務器的/usr/bin目錄下
3.賦予權限:
- chmod 777 chromedriver
- 賦予權限