Monthly Archives: June 2015

Raspberry Pi – Node.js – Mongodb recipe

Node.js with Mongodb build

Post install cleanup


sudo apt-get update
sudo apt-get remove --purge wolfram-engine
sudo apt-get remove --purge minecraft-pi python-minecraftpi
sudo apt-get remove --purge penguinspuzzle
sudo apt-get remove --purge scratch nuscratch sonic-pi

Remote Access with VNC

sudo apt-get install tightvncserver

Setup password…

vncserver -geometry 1024x728 -depth 24 -dpi 120

Kill the server in preparation for boot automation…

vncserver -kill :1

Setup the autostart init.d based file in `/etc/init.d`

sudo nano /etc/init.d/vncserver

File contents:

#!/bin/sh
### BEGIN INIT INFO
# Provides: VNC
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the VNC server
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

eval cd ~pi

case “$1” in
start)
su pi -c “/usr/bin/vncserver :1 -geometry 1024×728 -depth 24”
echo “Started VNC server.”
;;
stop)
su pi -c “/usr/bin/vncserver -kill :1”
echo “Stopped VNC server.”
;;
*)
echo “Usage: vncserver [start|stop]” >&2
exit 3
;;
esac

exit 0

The following commands will set up the new file so it will operate correctly…

sudo chown root:root /etc/init.d/vncserver
sudo chmod 755 /etc/init.d/vncserver
sudo update-rc.d vncserver defaults

Now we need to add cut/paste support…

sudo apt-get install autocutsel

and add it to the VNC startup file in the PI user account…

sudo nano .vnc/xstartup

so it looks like this:


#!/bin/sh
autocutsel -s CLIPBOARD -fork
autocutsel -s PRIMARY -fork
xrdb $HOME/.Xresources
xsetroot -solid grey

#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

Installing Nodejs dependencies:

build-essential and git

sudo apt-get install build-essential git

Node.js

wget http://node-arm.herokuapp.com/node_latest_armhf.deb sudo dpkg -i node_latest_armhf.deb

MongoDB

git clone https://github.com/svvitale/mongo4pi.git cd mongo4pi sudo ./install.sh