I'm using html-pdf to generate and pdf on my nodejs app, which is then being uploaded to S3. This works fine on my local, but I face this error
Error: spawn /usr/local/bin/phantomjs ENOENT
when running the deployed app on EBS. I have added a config file under .ebextensions with the below content to install phantomjs, but it doesn't seem to fix the problem.
01_install_dependencies:
command: sudo yum install -y fontconfig freetype freetype-devel fontconfig-devel libstdc++
02_download_phantomjs:
command: wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
03_prepare_dir:
command: sudo mkdir -p /opt/phantomjs
04_unbzip2:
command: bzip2 -df phantomjs-2.1.1-linux-x86_64.tar.bz2
05_untar:
command: sudo tar -xvf phantomjs-2.1.1-linux-x86_64.tar --directory /opt/phantomjs/ --strip-components 1
06_symlink:
command: sudo ln -fs /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
PS: This used to work earlier, but I recently upgraded the node platform version on EBS, as well as the versions of a few github action runners (node, ubuntu, deploy). Not quite sure if these had anything to do with it.
I have shaed hosting on siteground , basically my server runs PHP , but i also wanted to run node on my server , so i ssh'ed using putty and ran the following commands:
curl http:// nodejs.org/dist/latest/node-v8.11.3-linux-x64.tar.xz Then unzipped it.
mv node-v8.11.3-linux-x64/ nodejs.
mkdir ~/bin
cp nodejs/bin/node ~/bin
The last command throws an error
cp: connot stat nodejs/bin/node: no such file or directory exists
I was basically trying to follow the tutorial on HERE.
Follow this guide instead, it's from the actual node GitHub instead of a Medium article: How to install Node.js via binary archive on Linux?.
You are going to need 3 specific programs:
curl to download stuff
tar to deal with tar files
xz to deal with zip compression
Make sure all of those are installed using (and this assumes you're using Ubuntu or a distro that leverages apt):
sudo apt-get update && sudo apt-get install -y curl tar xz-utils
After that do something a little bit different from the tutorial
Download and save the archive:
curl -O https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz
Untar the archive:
tar xf node-v8.11.3-linux-x64.tar.xz
Make a nodejs directory to organize your versions:
mkdir /usr/local/lib/nodejs
Move the unarchived folder to your /usr/local/lib/nodejs folder:
mv node-v8.11.3-linux-x64 /usr/local/lib/nodejs/
Symlink node and npm into the /usr/bin/ folder:
ln -s /usr/local/lib/nodejs/node-v8.11.3-linux-x64/bin/node /usr/bin/node
ln -s /usr/local/lib/nodejs/node-v8.11.3-linux-x64/bin/npm /usr/bin/npm
Make sure everything is working:
node -v
npm -v
I installed Nginx 1.8 (compiled from source) on Debian 7:
cd /opt/
sudo wget http://nginx.org/download/nginx-1.8.0.tar.gz
sudo wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
sudo tar -zxvf nginx-1.8.0.tar.gz
sudo tar -zxzf ngx_cache_purge-2.3.tar.gz
cd /opt/nginx-1.8.0/
sudo ./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module --with-ipv6 --add-module=/tmp/ngx_cache_purge-2.3
sudo make && make install
sudo adduser --system --no-create-home --disabled-login --disabled-password --group nginx
sudo wget -O init-deb.sh http://www.linode.com/docs/assets/1538-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
Than I start nginx with the following command:
sudo /etc/init.d/nginx start
And everything works fine until now.
The problem is when I try to install HHVM it doesn't work:
sudo wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
sudo echo deb http://dl.hhvm.com/debian wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm libgmp-dev libmemcached-dev
sudo update-rc.d hhvm defaults
And when I finally run:
sudo /usr/share/hhvm/install_fastcgi.sh
I get the following error:
Checking if Nginx is installed
Nginx not found
Any thoughts how I can install HHVM with Nginx compiled from source?
You're going to have to read the script and apply its patch manually. It's hardcoded to work with the distro-supplied nginx, and assumes that it's installed in that location -- since the deb we provide for Debian sticks a particular script in the nginx system configuration anyways. Your manually built nginx is in a different location; the script would have no way of knowing where to find it!
Here's the source for the install_fastcgi.sh -- the relevant bit is that it inserts a line after server_name to include hhvm.conf. You can find that hhvm.conf either here or it's probably already on your system at /etc/nginx/hhvm.conf.
BTW, the script really isn't that complicated. In general, a good way to figure out why something broke is to skim through it and see what it's doing :)
My Flash plugin just won't work for Firefox on Linux Mint.
I am running Linux Mint 14 Nadia 64bit.
Downloaded firefox-27.0.1.tar.bz2
Extracted it
Ran ./firefox it works fine
Downloaded install_flash_player_11_linux.x86_64.tar.gz
Extracted it
Copied the plugin: cp libflashplayer.so
/home/gary/.mozilla/plugins/
Copied the Flash Player Local Settings configurations: sudo cp -r
usr/* /usr
Generated dependency lists for Flash Player: ldd
/home/gary/.mozilla/plugins/libflashplayer.so
Plugin still doesn't work.
Any help would be appreciated.
start with a command in terminal
sudo apt-get alien - it is a converter worth using .
For rpm to deb use code sudo alien <file-name>.rpm
for tar.gz use code sudo alien -k <file-name>.tar.gz
for tar.bz2 use code sudo alien -d <file-name>.tar.bz2
for tgz use code sudo alien --to-deb ~/<file-name>.tgz
good luck .
~ $sudo alien -d firefox-27.0.1.tar.bz2
wait
double click new deb file
Silverlight
And download chrome this plugin rocks it will enable flash 15 ...
Pepperflash
sudo apt-get install mint-flashplugin
This works from terminal.
I set up PhantomJS and recorded it to video: https://www.dailymotion.com/video/xnizmh_1_webcam
Build instructions: http://phantomjs.org/build.html
Is there anything wrong in my setup?
After I set it up I read the quick start tutorial and tried to write this code
phantomjs hello.js
It gives me "command not found" error. How can I solve this problem?
Guidouil's answer put me on the right track. I had to add one additional symlink to /usr/bin/, and I did direct symlinks for all 3 - see below.
I'm installing on Ubuntu server Natty Narwhal.
This is exactly what I did.
cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
And finally when I do
phantomjs -v
I get 1.9.7
If anyone sees any problems with what I've done, please let me know.
PhantomJS is on npm. You can run this command to install it globally:
npm install -g phantomjs-prebuilt
phantomjs -v should return 2.1.1
download from phantomjs website the prebuilt package :
http://phantomjs.org/download.html
then open a terminal and go to the Downloads folder
sudo mv phantomjs-1.8.1-linux-x86_64.tar.bz2 /usr/local/share/.
cd /usr/local/share/
sudo tar xjf phantomjs-1.8.1-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.8.1-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
then to check install phantomjs -v should return 1.8.1
Install from package manager:
sudo apt-get install phantomjs
Here are the build steps I used (note these instructions are for version 1.3. See comments to this answer for the installation instructions of the latest PhantomJS):
sudo apt-get update
sudo apt-get install git-core
sudo apt-get install build-essential
sudo apt-get install libqt4-dev libqtwebkit-dev qt4-qmake
git clone git://github.com/ariya/phantomjs.git && cd phantomjs
git checkout 1.3
qmake-qt4 && make
Now install Xvfb
sudo apt-get install xvfb xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
Launch Xvfb:
Xvfb :23 -screen 0 1024x768x24 &
Now run phantom:
DISPLAY=:23 ./phantomjs hello.js
For PhantomJS version above 1.5, consider this (verbatim copy of the build instructions on the phantom website):
For Ubuntu Linux (tested on a barebone install of Ubuntu 10.04 Lucid
Lynx and Ubuntu 11.04 Natty Narwhal):
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.7
./build.sh
For Ubuntu you can use the prebuilt versions downloadable from the PhantomJS site.
If you have some serious time on your hands you can also build it yourself. (This is exactly the procedure from Nikhil's answer).
The guys over at PhantomJS recommend using the binaries to save time:
Warning: Compiling PhantomJS from source takes a long time, mainly due to thousands of files in the WebKit module. With 4 parallel compile jobs on a modern machine, the entire process takes roughly 30 minutes. It is highly recommended to download and install the ready-made binary package if it is available.
With a modern machine they mean > 4 cores, > 8gb mem I think. I tried it on a micro AWS instance and gave up after 2 hours.
In short: install the prebuilt packages from the PhantomJS site per their instructions.
Personaly I prefer using npm (see Arnel Bucio answer)
sudo npm install -g phantomjs
but! I noticed that some of npm module still can't see it as global executable.
so!
Create new /usr/share/phantomjs/ directory link
cd /usr/share
sudo ln -s ../lib/node_modules/phantomjs/lib/phantom phantomjs
Remove old /usr/bin/phantomjs executable link and create the new one
cd /usr/bin
sudo mv phantomjs phantomjs.old
sudo ln -s ../share/phantomjs .
in my vagrant bootstrap:
apt-get install -y build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
echo y | ./build.sh
ln -s /home/vagrant/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
cd ..
I have done with this.
sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh
See link
Installation guide is in ...
https://gist.github.com/julionc/7476620
And run in terminal with this command
phantomjs --webdriver=4444
From the official site: phantomjs site
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.8
./build.sh
For Ubuntu, download the suitable file from http://phantomjs.org/download.html. CD to the downloaded folder. Then:
sudo tar xvf phantomjs-1.9.0-linux-x86_64.tar.bz2
sudo mv phantomjs-1.9.0-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs
Make sure to replace the file name in these commands with the file you have downloaded.
Be aware this is definitely one way to do it:
$ sudo apt-get install phantomjs
$ phantomjs -v
1.6.0
Sadly, it installs 1.6 and not the latest one, but this works for my purposes.
I know this is too old, but, just i case someone gets to this question from Google now, you can install it by typing apt-get install phantomjs
On Ubuntu for Windows, I found neither apt-get nor npm versions worked for me. What worked was the script from this comment.
For ease of use, I pasted the whole thing into a script file called install_phantomjs.sh, made it executable (chmod u+x install_phantomjs.sh), and then ran it (./install_phantomjs.sh)
Or the latest - 32bit version Linux
sudo wget http://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/bin/phantomjs
Installation and Calling Phantomjs
Follow the steps doesn't work, but cloned from others built. (ver2.0)
Bellow the installation procedure by Julio Napurí https://gist.github.com/julionc
Version: 1.9.8
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
Install these packages needed by PhantomJS to work correctly.
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev
Get it from the PhantomJS website.
cd ~
export PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
Once downloaded, move Phantomjs folder to /usr/local/share/ and create a symlink:
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
Now, It should have PhantomJS properly on your system.
phantomjs --version
I have found this simpler way - Phantom dependencies + Npm
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev
and npm
[sudo] npm install -g phantomjs
Done.
On linux to run hello.js don't forget to add the path of hello.js:
phantomjs YourPathToPhantomjsFolder/examples/hello.js
If you want to use phantomjs easily, you can use it at phantomjscloud.com
You can get the result just by http request.
This is how I place a specific version of phantomjs in /usr/local/bin on my docker containers.
curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
| tar jxvf - --strip-components=2 -C /usr/local/bin/ ./phantomjs-1.9.8-linux-x86_64/bin/phantomjs
or with out ./ depending on OS.
curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
| tar jxvf - --strip-components=2 -C /usr/local/bin/ phantomjs-1.9.8-linux-x86_64/bin/phantomjs
You can get up and running without sudo or npm. Simply download, extract, and add to path.
This has the added advantage of easy backup if you are in the habit of backing up your entire home folder which I highly recommend. This also works with any version of Linux.
➤ cd ~
➤ wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
➤ mkdir phantomjs
➤ tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C phantomjs
➤ echo 'export PATH="$PATH:$HOME/phantomjs/bin"' >> .profile
➤ source .profile
➤ phantomjs -v
2.1.1
The disadvantages are:
You will need to manually upgrade
Other users will not have access to this.
You could use a very simple shell script for installing/upgrading
#!/bin/sh
# install_phantomjs.sh $VERSION
$VERSION = $1
printf "Downloading PhantomJS $VERSION...\n"
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$VERSION-linux-x86_64.tar.bz2"
printf "Extracting PhantomJS $VERSION to ~/phantomjs...\n"
mkdir ~/phantomjs
tar xjf phantomjs-$VERSION-linux-x86_64.tar.bz2 -C ~/phantomjs
printf "Done! Make sure $HOME/phantomjs/bin is in your path.\n"
Or in a Dockerfile
# Download and setup PhantomJS
ENV PHANTOMJS_VERSION 2.1.1
RUN curl -fSL "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2" -o /tmp/phantomjs.tar.bz2 && \
mkdir ~/phantomjs && \
tar xjf /tmp/phantomjs.tar.bz2 -C ~/phantomjs && \
rm /tmp/phantomjs.tar.bz2
ENV PATH /home/$USERNAME/phantomjs/bin:$PATH
Here is what I did
on my ubuntu 16.04 machine
sudo apt-get update
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
sudo mv path/where/you/downloaded/phantomjs /usr/bin
and finally when I do
phantomjs -v
I get 2.1.1
After going through every answer of this thread. I think this is the best solution for installing and running phantomjs in ubuntu.