Installing “Phant” a big-data collector for IOT devices, in Ubuntu server

Phant is a modular node.js application that is distributed via npm. Talking about its application, its a data logging tool for collecting data from the Internet of Things. And best part is, it is a open source software.
Initial package requirements :-

sudo apt-get install -y build-essential g++ curl libssl-dev apache2-utils git libxml2-dev 

I would recommend you to remove pre-installed packages, apt-get remove nodejs and stick with nvm. The deb packages get out-of-date fairly rapidly and using NVM will allow you to keep up much more easily. Remove any initial nodejs packages , if installed

sudo apt-get remove nodejs

TO install nvm along with Node v4.1.0

git clone git:// ~/nvm

echo '. ~/nvm/' >> ~/.bashrc && . ~/.bashrc
nvm install v4.1.0

nvm use v4.1.0

check whether these steps are followed well till now or not, by checking node version from following command.

 node -v

Now, we are ready to install phant package using npm

npm install -g phant

Starting phant server


you should see something like at this stage

root@nsit:~# phant
phant http server running on port 8080
phant telnet server running on port 8081

Now, what after restart? To make nvm run after resart you have to make the whatever version you are using as default.

nvm alias default v4.1.0

Also, You may have noticed that phant will stop running if you end your SSH connection to the Ubuntu server. You can get around this by installing the forever npm module.

npm install -g forever

Now, First of all we have to check where the npm packages are installed.

npm list -g --depth=0

now use following command with respective path of nvm libraries location shown in last step

forever start /nvm/versions/node/v4.1.0/lib/node_modules/phant

Now you can connect to phant by using telnet command, on port 8081 or on browser, on 8080 port. To find ip you can use ifconfig command.