I am going to assume that you know how to login to the command prompt on your Raspberry PI from your chosen system or you are accessing it via the console.

Most of the information that is contained below has been found on the internet and modified to suit the need here.

First off we are going to create a directory called node and this is where we are going to install node.js rather than in ‘/usr/local’ just make life a little more simple when updating things in the future.

sudo mkdir /opt/node

The next step is to dowload the Node.JS ARM binary package, unpack it and copy the content to our node directory /opt/node.

wget http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz
tar xvzf node-v0.10.24-linux-arm-pi.tar.gz
sudo cp -r node-v0.10.24-linux-arm-pi/* /opt/node

Finally we have to add Node.JS to our path.

sudo ln -s /opt/node/bin/node /usr/local/bin/node
sudo ln -s /opt/node/bin/npm /usr/local/bin/npm

That completes installing nodejs on the RBPI so next we will install the PFClient

Enter the following commands on the command line

cd ~

then

sudo wget http://clieentfiles.planefinder.net/pfclient-latest.tgz
sudo npm install -g pfclient-latest.tgz

The command above will install PFClient (Be warned it will take some time to install)

You should see lots of information scrolling on the terminal window

and when completed you should see something like this

/usr/local/bin/pfclient -> /usr/local/lib/node_modules/pfclient/client.js
/usr/local/bin/pfclient-service -> /usr/local/lib/node_modules/pfclient/launcher.js
pfclient@2.0.56 /usr/local/lib/node_modules/pfclient
âââ open@0.0.4
âââ querystring@0.2.0
âââ byline@4.1.1
âââ prompt@0.2.12 (revalidator@0.1.6, pkginfo@0.3.0, read@1.0.5, utile@0.2.1, winston@0.6.2)
âââ forever-monitor@1.2.3 (watch@0.5.1, pkginfo@0.3.0, minimatch@0.2.14, utile@0.1.7, ps-tree@0.0.3, broadway@0.2.9)
âââ express@3.4.8 (methods@0.1.0, merge-descriptors@0.0.1, cookie-signature@1.0.1, range-parser@0.0.4, fresh@0.2.0, debug@0.7.4, buffer-crc32@0.2.1, cookie@0.1.0, mkdirp@0.3.5, commander@1.3.2, send@0.1.4, connect@2.12.0)
âââ serialport@1.3.1 (bindings@1.1.1, sf@0.1.6, async@0.1.18, nan@0.7.1, optimist@0.3.7)

then type sudo pfclient at the command prompt and press enter then follow the on screen prompts to set up PFClient as per instructions

We need now a start script for PFClient. The script will start PFCLient with the user ‘pi’ . The output stream from PFCLient will be stored in the file /tmp/pfclient.log. Just create the file pfstart.sh in your current directory with the following content:

at the command prompt and press enter then follow the on screen prompts

sudo nano pfstart.sh

The add this

#!/bin/bash

NODE=/opt/node/bin/node
PFCLIENT_SERVER=/usr/local/lib/node_modules/pfclient/client.js
USER=pi
OUT=/tmp/pfclient.log

case “$1” in

start)
echo “starting node: $NODE $PFCLIENT_SERVER”
sudo -u $USER $NODE $PFCLIENT_SERVER > $OUT 2>$OUT &
;;

stop)
killall $NODE
;;

*)
echo “usage: $0 (start|stop)”
esac

exit 0

Then press ctrl and X then press Y to save the file and exit from nano

Next enter the following commands

sudo chmod 755 pfstart.sh
sudo cp pfstart.sh /etc/init.d
sudo update-rc.d pfstart.sh defaults

It’s time to start pfclient with our start script.

sudo /etc/init.d/pfstart.sh start

To stop pfclient just enter

sudo /etc/init.d/pfclient.sh stop

To check that everything is ok issue the following command

cat /tmp/pfclient.log

This should display the status of the software that is running

and if you want to remove pfstart.sh then issue the following commands

sudo rm /etc/init.d/pfclient.sh
sudo update-rc.d pfstart.sh remove

I hope you find this of use