Skip to content

Server on Cubieboard

cjdaly edited this page Sep 16, 2013 · 13 revisions

Updated 15-September-2013

Update setup steps.

Hardware setup

The image below is a Cubieboard that my friend James 3d-printed a case for using this design. Some notes:

  • Power (right) is connected to 5V, 2 Amp power adapter.
  • Ethernet (left) connection to LAN.
  • FTDI basic 3.3V, connect RXI, TXO and GND to the Cubieboard TTL pins (top) at 115200 baud (8/1/N). Use this to watch boot process and as a root shell.

cubie1

Install Ubuntu with Berryboot

The image above shows how I am running Napkin on the Cubieboard, but for the initial Ubuntu installation I connected mouse, keyboard (through a powered USB hub) and HDMI monitor and then followed these Berryboot steps to install Ubuntu on an SD card. The image I chose had the label Linaro Ubuntu server 2013.01.

Ubuntu initial setup

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
sudo apt-get install -y git
sudo apt-get install -y lsof
sudo apt-get install -y libc6-armel
sudo apt-get install -y libsfgcc1

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 'linaro' with the userid you will use to run the Napkin server, if different):

linaro hard nofile 40000
linaro soft nofile 40000

Reboot the system after editing the limits.conf file for the changes to take effect:

shutdown -r now

Setup Java

See this blog post about getting the Oracle JRE that works on pcduino. The Cubieboard and the pcduino both use the Allwinner A10 SoC, so I guessed that the same Java setup steps would work, and so far it has.... I got the server/headless download: ejre-7u21-fcs-b11-linux-arm-vfp-server_headless-04_apr_2013.gz on a Windows box and used WinSCP to copy it to the Cubieboard.

On the Cubieboard:

cd ~
mkdir java
cd java

Use WinSCP (or similar sftp client) to copy the Java download to the directory just created. Then extract the download:

tar xvf ejre-7u21-fcs-b11-linux-arm-vfp-server_headless-04_apr_2013.gz

Now add ~/java/ejre1.7.0_21/bin to the $PATH and then check that it's working:

java -version

Setup Neo4J

cd ~
mkdir neo4j
cd neo4j
wget -O neo4j-community-1.9.1.tgz 'http://download.neo4j.org/artifact?edition=community&version=1.9.1&distribution=tarball'
tar xvf neo4j-community-1.9.1.tgz

Make sure to add ~/neo4j/neo4j-community-1.9.1/bin to the $PATH and then check:

neo4j status

Setup JRuby

cd ~
mkdir jruby
cd jruby
wget -O jruby-bin-1.7.3.tar.gz 'http://jruby.org.s3.amazonaws.com/downloads/1.7.3/jruby-bin-1.7.3.tar.gz'
tar xvf jruby-bin-1.7.3.tar.gz

Add ~/jruby/jruby-1.7.3/bin to $PATH and then check:

jruby -v

Now install gems used by Napkin:

gem install --no-rdoc --no-ri rest-client sinatra json kramdown

Clone Napkin

Next, clone the napkin code from github:

cd ~
git clone https://github.com/cjdaly/napkin.git

Typical startup

To add java, neo4j and jruby to the path:

source ~/napkin/server/server-setup.sh

For a typical startup:

neo4j start
cd ~/napkin/server/sinatra
jruby --server -J-Xms128M -J-Xmx128M napkin.rb config-cubie1.json >& napkin.log &
tail -f napkin.log