Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Last active April 13, 2022 20:30
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save max-mapper/4322201 to your computer and use it in GitHub Desktop.
Save max-mapper/4322201 to your computer and use it in GitHub Desktop.
raspberry pi scripts

raspberry pi setup stuff

what these instructions/files are useful for:

  • make raspberry pi run processes (like node.js servers) automatically on startup and have them monitored by a process monitor
  • get node running on the pi
  • install the raspbian OS on an sd card and boot the pi up and login over ssh

notes/instructions

  • after cloning the stuff in setup.sh you'll have to make and make install everything manually. node will take hours to compile
  • put mongroup.conf in /home/pi/mongroup.conf
  • put mongroup-startup.conf in /etc/init/mongroup.conf
  • install upstart with apt-get install upstart and ignore the warnings
  • remove the secure_path statement from /etc/sudoers so sudo gets your users PATH
  • you can add new lines to ~/mongroup.conf to configure new things that should always be running when the raspi is on
  • if you do the raspi-config sd card expand thing it may cause your next restart to take a lonnnggg time
# this formats a sd card to boot raspberry pi, you can then hook up to raspi over ethernet cable from
# a mac computer. turn on internet sharing in sys prefs first and then the raspi should be 192.168.2.2
# first download http://www.raspberrypi.org/downloads and unzip to raspbian.img
# you might have to change the device name, /dev/disk1s1 is what mac os usually mounts sd cards as
# the dd command might take a couple of minutes, hit ctrl+t to check status
sudo diskutil unmount /dev/disk1s1
sudo dd bs=1m if=raspbian.img of=/dev/rdisk1
sudo diskutil eject /dev/rdisk1
require('http').createServer(handler).listen(80)
function handler(req, res) { res.end('hello world!') }
pids = /var/run/
logs = /var/log/
web = node /home/pi/index.js
#!/bin/sh
sudo apt-get upgrade
sudo apt-get install build-essential libssl-dev git screen avahi-daemon vim upstart
mkdir src
git clone https://github.com/joyent/node.git src/node
git clone https://github.com/visionmedia/mon.git src/mon
git clone https://github.com/jgallen23/mongroup.git src/mongroup
description 'startup processes'
author 'maxogden'
start on runlevel [0123456]
task
exec start-stop-daemon --start -u pi --chdir /home/pi --exec /usr/local/bin/mongroup start
@BrianTheCoder
Copy link

when I try to compile node on my pi w/this I consistently get:
Illegal instruction
make[1]: *** [/home/pi/src/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory `/home/pi/src/node/out'
make: *** [node] Error 2

I have the 256mb version is yours the 512mb? Having a bitch of a time trying to get a recent node version to run on it. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment