Skip to content →

Category: Raspberry Pi

Node.js on the Raspberry Pi

I needed to install Node.js on the Raspberry Pi and searching the web gave me so many difficult ways to do it. But since node.js now distributed as a binary for the Raspberry Pi, it’s pretty easy.

First, go to http://nodejs.org/dist/latest/ and find the latest Raspberry Pi release. It’s the file ending in: linux-arm-pi.tar.gz

Then on the Raspberry Pi, update the package list
[sourcecode language="plain"]
sudo apt-get update

Update packages
[sourcecode language="plain"]
sudo apt-get upgrade -y

Create a directory to install node:
[sourcecode language="plain"]
sudo mkdir /opt/node

Change directories to a temporary directory.
[sourcecode language="plain"]
cd /tmp

Download the latest release you found at http://nodejs.org/dist/latest/
[sourcecode language="plain"]
wget http://nodejs.org/dist/latest/node-v0.10.17-linux-arm-pi.tar.gz

Uncompress it:
[sourcecode language="plain"]
tar xvzf node-v0.10.17-linux-arm-pi.tar.gz

Copy it to your new directory:
[sourcecode language="plain"]
sudo cp -r node-v0.10.17-linux-arm-pi/* /opt/node

Then add it to your environment variables by opening or creating .bash_profile in your home directory. (You nano if you can’t use vi.):
[sourcecode language="plain"]
cd
vi .bash_profile

Add the following to your .bash_profile
[sourcecode language="plain"]
PATH=$PATH:/opt/node/bin
export PATH

After saving the file, you’re all set!

Comments closed

Raspberry Pi Tip: Change keyboard layout

If you’re in the US like me and you start coding on your Raspberry Pi, you might quickly realize that when typing the pound key # you get the currency symbol: £

This is because the Raspberry Pi defaults to the British Keyboard layout. To change this, as sudo edit the file:
[sourcecode language="plain"]
etc/default/keyboard

Change XKBLAYOUT=”gb” to XKBLAYOUT=”us”
[sourcecode language="plain"]
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

Then restart your Pi.

Comments closed