Tag Archives: Headless Pi installation with Node-Red

Headless Pi Installation

tmp44EDThis blog entry refers to installing Jessie, Node Red and other utilities on a Pi 2 (not Pi 1 – there is a minor startup issue with Node-Red with that right now) specifically from the November 2015 Jessie image on the Raspberry Pi site.

Grab the November 2015 Jessie image from the Pi Foundation – and put that on an SD – plug it into the Pi – and wait for the Pi to appear on your network at which point you can access it with WinSCP.

The Pi should reboot into Jessie – which will typically be allocated an address on your system. I’d used this Pi elsewhere so I knew the router was likely to allocate 192.168.0.107 – and sure enough – a quick WINSCP and I was back in charge of the new operating system (user pi, password raspberry) all done without ever plugging a keyboard or monitor into the Pi.

First things first – I use winSCP to which I have installed Putty (instructions on the winSCP site) so a quick terminal later, pop up Raspi-Config. If using an SD, the EXPAND FILESYSTEM is a good idea – in my case it was not necessary.

In Raspi-Config change the Pi password, change the Hostname to jessie2 or whatever you want, enable SPI and I2c and force audio through the 3.5mm socket.

A reboot (which in my case showed some error message about spi_bcm2708 – but then it ALWAYS does that until you upgrade) then requires  changing the password in winSCP of course.. and you’re soon back in business.

My script is on Bitbucket along with the support script – note this was made for ME – for my requirements – it may need altering a tad for you. I wanted Apache+PHP purely so I could have PHPLITEAdmin which is needed to work with SQLITE3. I also needed Mosquitto with Websockets – and  Node-Red with lots of nodes including my own.

After copying the two files into /home/pi I then used WinSCP – looked at the files – right-click properties and ticked the first X (execute) box in each case.

From there one runs (as PI !!) the script

Here is the main script for RPI2

https://bitbucket.org/snippets/scargill/L8zjE

Here is the support script.

https://bitbucket.org/snippets/scargill/ayAG6

Save both in the /home.pi and call the first one whatever_you_like.sh ( I call mine pi-jessie-one.sh)

Do this as user pi with no extra privileges - if using winSCP do not add extra privileges (there's a way to do it using a sudo command under the sftp section - don't do it).

Copy the other file and specifically call it hackitt_includes.sh

Run the first one -  ./whatever_you_like.sh

LOTS of rubbish, lots of warnings, requests for passwords etc…  if asked to say YES/NO.SKIP etc. just use “y” every time.

At the end of all that the Pi will reboot. Go back into a terminal view using WinSCP and Putty -  type… node-red-start – and it will fail but you’ll see another instruction for starting the service.

with an editor (WinScp has an editor – I usually associate it with Notepad++) edit /home/pi/.node-red/settings.js

There is an entry that needs amending… see this.

image

Note that I have uncommented  the os.require line and added another with no comma on the end.

Run that. reboot and you’re all done.

At this point there is no security on Node-Red or the Node-Red UI – but they are easily added if you need them – when I figure out how to put that in a script (anyone offering to help) ie insert at an awkward point inside an existing file  - then I’ll add that in too.

That’s it – everything should work. It all sounds like a lot but now it all works it really isn’t that much of a pain.

Facebooktwittergoogle_pluspinterestlinkedin