Turn RaspberryPi-UA-NetInst into a NodeJS server

Rather than reduce Raspbian by uninstalling packages and hacking down services run at boot-up to give a minimal system that runs NodeJS, I thought I’d try starting with a minimal system using RaspberryPi-UA-NetInst and just adding what’s needed.

That link gives an excellent tutorial on getting started. But before you install it, there are tweaks to be made before installing it that will get a lot of stuff set up on installing, rather than afterwards. This is a great bonus because if you ever have to reinstall, you don’t have to reconfigure the system each time. Simply format the SD card, place your modified installer files on the card, put it in the RPi and boot up, cross fingers and it’ll all be installed in under 30 minutes. And it can all be done over WiFi without touching a network cable!

So simple! Just follow Method#1 in this previous tutorial of mine, but replace the contents of  on-first-login.sh with the following:

You might want to tweak the installer to create a user besides root, it seems to be a preferred way of doing things! But I’ll leave that to you. From here you can test out your new NodeJS server, check out this NodeJS tutorial.

This can be taken a few steps further still though! What if you want your entire NodeJS Pi server set up un an unattended fashion, right up to downloading your NodeJS source code from GitHub and running the server? And configuring systemd so it starts up automatically every time? No problem! Tutorial coming soon! 😉


NodeJS web server bits and pieces

Disadvantages of NodeJs:

Avoid asynchronous hell with Node Fibers:

Web framework for NodeJs:

GPIO access with NodeJs:

Installing Node.JS v4.0 on RPi

As usual, tutorials on Linux become out of date quickly. And as usual, linux tutorials always need fiddling to get working on any setup different to that of the author’s. So here is how I got node v4.0 installed on the RPi version B with Raspbian:

First, from this tutorial:

Then, from this tutorial:

Then edit ~/.bashrc:

Add this line  at the end:

Then edit ~/.profile:

Add this line at the end:


Finally you can get on with actually using it!

But if you want a slimmed-down Raspbian, try my tutorial on getting RaspberryPi-Ua-NetInst working with NodeJs.

This tutorial has a great introduction to using Node.JS. It requires NodeJS v4.0 which you should now have. Plus you now have nvm , the node version manager, which it also requires.