-
Notifications
You must be signed in to change notification settings - Fork 3
Server on BeagleBone black
Moved server-setup.sh
script down into directory with Sinatra server code.
The image below shows my initial BeagleBone black hardware setup. Some notes:
- USB power (lower left) is connected to 5V, 1 Amp power adapter.
- Ethernet (lower middle) connection to LAN.
- Adafruit console cable (right side). Connect black, green and white, but not red, to the serial debug port as described in Adafruit section here at 115200 baud (8/1/N).
I generally followed the 'Method 1' steps on this guide to Ubuntu on BeagleBoards. I used an x86-based Ubuntu system (like the one for the Ubuntu-x86 server configuration) to prepare the SD card. Here is a distillation of the steps:
cd ~
mkdir BeagleBone-Black
cd BeagleBone-Black
wget https://rcn-ee.net/deb/rootfs/raring/ubuntu-13.04-console-armhf-2013-11-15.tar.xz
tar xvf ubuntu-13.04-console-armhf-2013-11-15.tar.xz
cd ubuntu-13.04-console-armhf-2013-11-15
May need to install some of these utilities on the x86 machine (before running the setup_sdcard.sh
script below):
sudo apt-get install wget pv dosfstools parted git-core u-boot-tools
Next, connect a micro SD card to the Ubuntu x86 system and determine its unix device path. I prepared my SD card with a volume label of BBB-SD
. This string shows up when I run the lsblk
command:
The image above is trying to show that you want the disk device (in this example, /dev/sdc
), instead of the associated part(ition) device for the next step. The next step will copy Ubuntu to the SD card. Replace /dev/sdXXX
in the command below with the path for your SD card disk device. Be very careful with this because any existing data on the device will be lost!
sudo ./setup_sdcard.sh --mmc /dev/sdXXX --uboot bone
When the setup script is finished, disconnect the SD card from the Ubuntu x86 machine, place it in the BeagleBone black and turn on the power to boot Ubuntu. Use the serial debug console to login with userid ubuntu
and password temppwd
for the next set of steps.
I got a Belkin "G Wireless USB Network Adapter" to work with the BeagleBone without any hassle. Checking the FCC-ID as described here, I apparently have the 3xxx version.
For this hardware configuration, I also switched to a 2A power supply that plugs into the barrel jack on the BeagleBone.
With the ethernet disconnected and this Belkin wifi connected to the BeagleBone USB, Ubuntu has no problem detecting and using the device. After the initial bootup, use this command to confirm the hardware is detected:
iwconfig
Next edit /etc/network/interfaces and uncomment and fixup the wifi section so it looks something like this:
# WiFi Example
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "..."
wpa-psk "..."
Now reboot with sudo shutdown -r now
and then check iwconfig
again after the reboot to see
if the wifi is associated with an access point. The setup in the next section depends on a working
internet connection (either wifi or ethernet).
Run the following commands to install components needed by the Napkin server (some of these may already be present):
sudo apt-get update
sudo apt-get install -y ssh git lsof
These next 2 dependencies are needed by the software floating point variant of the Java runtime (see this issue about hardware float):
sudo apt-get install -y libc6-armel libsfgcc1
The Apache web server is started by default in this Ubuntu distro, but I'm not using it. These notes explain how to disable it:
sudo update-rc.d apache2 disable
Similarly, disable the DHCP server which is running by default:
sudo update-rc.d udhcpd disable
See here and here for notes on how to disable or otherwise alter the behavior of the blue LEDs. For now, I sudo vi /etc/rc.local
and add these lines to disable the blinking LEDs during boot:
echo 0 > '/sys/class/leds/beaglebone:green:usr0/brightness'
echo 0 > '/sys/class/leds/beaglebone:green:usr1/brightness'
echo 0 > '/sys/class/leds/beaglebone:green:usr2/brightness'
echo 0 > '/sys/class/leds/beaglebone:green:usr3/brightness'
To set the system timezone:
sudo dpkg-reconfigure tzdata
Also need to increase open files limit (the value reported by running: ulimit -n
). Edit /etc/security/limits.conf and add lines like this (replace 'ubuntu' with the userid you will use to run the Napkin server, if different):
ubuntu hard nofile 40000
ubuntu soft nofile 40000
Reboot the system after editing the limits.conf file for the changes to take effect:
sudo shutdown -r now
Download the Oracle Java 7 ARM Server JRE. I get the server, headless, software floating point download, ejre-7u45-fcs-b15-linux-arm-vfp-sflt-server_headless-26_sep_2013.gz
on a separate system (download from web browser) and use sftp (Linux) or WinSCP (Windows) to copy it to the BeagleBone.
On the BeagleBone:
cd ~
mkdir java
cd java
mkdir sflt
cd sflt
Use the sftp client to copy the Java download to the directory just created. Then extract the download:
tar xvf ejre-7u45-fcs-b15-linux-arm-vfp-sflt-server_headless-26_sep_2013.gz
cd ~
mkdir neo4j
cd neo4j
wget -O neo4j-community-2.0.0.tgz 'http://download.neo4j.org/artifact?edition=community&version=2.0.0&distribution=tarball'
tar xvf neo4j-community-2.0.0.tgz
cd neo4j-community-2.0.0/conf
Edit the neo4j-wrapper.conf
file, uncomment and set values for the properties below:
wrapper.java.initmemory=96
wrapper.java.maxmemory=96
Also, add this line to the neo4j-wrapper.conf
file:
wrapper.java.additional=-XX:MaxPermSize=32M
Now edit the neo4j.properties
file and uncomment and set these values to constrain usage of memory mapped IO:
neostore.nodestore.db.mapped_memory=1M
neostore.relationshipstore.db.mapped_memory=1M
neostore.propertystore.db.mapped_memory=1M
neostore.propertystore.db.strings.mapped_memory=1M
neostore.propertystore.db.arrays.mapped_memory=1M
See Neo4j issue 1384 for more details on how these configuration settings were determined.
cd ~
mkdir jruby
cd jruby
wget -O jruby-bin-1.7.9.tar.gz 'http://jruby.org.s3.amazonaws.com/downloads/1.7.9/jruby-bin-1.7.9.tar.gz'
tar xvf jruby-bin-1.7.9.tar.gz
Next, clone the napkin code from github:
cd ~
git clone https://github.com/cjdaly/napkin.git
Now add java, neo4j and jruby to the path, and confirm each one gives a reasonable version/status message.
source ~/napkin/server/sinatra/server-setup.sh
Now install gems used by Napkin:
gem install --no-rdoc --no-ri rest-client sinatra json kramdown
cd ~/napkin/server/sinatra
source server-setup.sh
./napkin.sh -start systems/bone2
tail -f napkin.log
./napkin.sh -status
./napkin.sh -stop