Having got it for an excuse to play with node.js it was disappointing to find the included Angstrom Distribution couldn't even update to anywhere near the newest node.js version and so many tutorials referred to libraries which couldn't be used or didn't exist for it. Queue an embarrassing long time passing with it sitting idle on my desk...
Originally I had wanted to install Fedora, and while there is now support included with v20 (and postings suggesting it is possible to install), BeagleBone themselves have swapped to Debian so I will not fight against the officially chosen OS.
Here is my (work in progress) configuration to install Debian and get it up and running properly.
Install
Follow the official instruction from beagleboard.org. Download the non eMMC flasher Debian image > Write to SD card > Power on (holding the boot button)
Login, Network, Users and Update
# log in for the first time (a. plug in the ethernet cable into a dhcp router and look on the attached devices list to find the IP or b. connect the device via USB to a PC and ssh to 192.168.7.2)
ssh to 192.168.7.2
root
# (no password)
# set the ip address to be static *
connmanctl services
# *AO Wired ethernet_c8a030a89c67_cable
connmanctl config ethernet_c8a030a89c67_cable --nameservers 8.8.8.8 4.4.4.4 --ipv4 manual 192.168.0.45 255.255.255.0 192.168.0.1
# <connection> <google dns> <ip address> <netmask> <gateway>
# if you have used the network interface to connect in, this will now stop and you will have to reconnect on the ip you just specified
# set the root password
passwd
# expand the image (as there is hardly any space on the 2GB one)
# http://elinux.org/Beagleboard:BeagleBoneBlack_Debian and http://shrkey.com/expanding-your-ubuntu-microsd-partition/
cd /opt/scripts/tools/
git pull
./grow_partition.sh
shutdown -r now
resize2fs /dev/mmcblk0p1
df -h
# Filesystem Size Used Avail Use% Mounted on
# rootfs 29G 1.5G 27G 6% /
# update the system
apt-get update
apt-get install aptitude
aptitude update
aptitude full-upgrade
cd /opt/scripts/tools/
git pull
./update_kernel.sh
# add in an ssh key for easy access
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
# Paste in public key from puttygen (from the program display where there are no newlines etc.)
chmod go-w ~/ ~/.ssh/ ~/.ssh/authorized_keys
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys
systemctl restart sshd.service
Cleanup
# remove services which are taking port 80
systemctl disable bonescript-autorun.service
systemctl disable bonescript.service
systemctl disable bonescript.socket
systemctl disable cloud9.service
systemctl disable cloud9.socket
shutdown -r now
netstat -tulpn
# # port 80 and 3000 now no longer bound
# tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 839/sshd
# tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 833/xrdp-sesman
# tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 807/xrdp
# tcp6 0 0 :::8080 :::* LISTEN 862/apache2
# tcp6 0 0 :::22 :::* LISTEN 839/sshd
Node.js Test Project
# add a new user/directory for the project
mkdir /home/sites/
# -s : set users shell to bash (defaults to sh otherwise)
# -d : custom path
# -m : create the user's home directory
useradd myproject -s /bin/bash -d /home/sites/myproject -m
# log into the user
su myproject
mkdir ~/app/ && cd $_
nano helloworld.js
# # add the HTTP helloworld from http://howtonode.org/hello-node
# # don't use port 80 as only root can bind to this
node helloworld.js
# Server running at http://127.0.0.1:8000/
#
# browse to 192.168.0.45:8000 in you browser and you should see
# Hello World
Notes
# * the default way of setting up networking now seems to be to use connman, if you want to use the following /etc/network/interfaces (as per the current documentation) you will need to disable connman first or its dhcp setup rule will take precedence every time the device is rebooted
systemctl disable connman.service
systemctl stop connman.service
nano /etc/network/interfaces
# auto eth0
# iface eth0 inet static
# address 192.168.0.45
# netmask 255.255.255.0
# network 192.168.0.0
# gateway 192.168.0.1