Ambrogio did a very nice post on how to install java & openhab on BBB:
Follows an alternative approach for installing JAVA and OpenHab on BBB which is hopefully more newbie-friendly.
1) Where is my Beaglebone ?
I have never played with Beaglebone before, so I assumed it was more or less an RPi and did not bother to look at the details.
Some differences that might delay an excited user are: HDMI plug is not the typical size (Type A), it is micro (type D)
http://en.wikipedia.org/wiki/HDMI#mediaviewer/File:HDMI_Connector.jpg
So you need a micro hdmi cable or adapter to connect BBB directly on a monitor.
http://search.ebay.com/hdmi-micro-d
However, since Debian Linux is already installed in the internal eMMC 4GB, of the latest version of BBB, you can do stuff headless (without monitor) straight away.
So, hook an ethernet cable, power up BBB over USB. Note: use a dedicated PC USB (not a hub, where power is shared across).
(had to press reset for it to boot) ...and blue leds are flashing, Debian is up and running.... but what's the IP address ?
You can find out it’s IP with a number of ways, the easiest one is to try this:
this should by default work on linux/mac but for windows only if you have an mDNS/bonjour service installed.
(if you can’t be bother with bonjour, try FING or see your access point / modem DHCP list)
and you will see this web site running on BBB
of course SSH will work too, username root , with blank password.
(can use putty.exe on windows)
2) Installing JAVA
You can easily install java in BBB via the repository like this:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 apt-get update apt-get install oracle-java8-installer
The above installs the Java8 hard float after accepting the License Agreement ASCII screen, and configures the environment.
Hardfloat can have dramatic performance boost on some applications. More details here:
http://trouch.com/2013/01/12/raspberry-pi-benchmark/
https://blogs.oracle.com/jtc/entry/comparing_arm_linux_jvms_revisited
... Alternatively if you want to install JAVA manually:
First step is to download the JAVA8 "ARMv7 Linux - VFP, HardFP ABI, Little Endian1" from oracle. However this is not possible command line from BBB with "wget" because, oracle want's you to accept licences and login. So you need to do it from you desktop and then transfer the file to BBB. One way to transfer the file is via SFTP , so in windows you need to use something like filezilla or http://the.earth.li/~sgtatham/putty/latest/x86/psftp.exe
you then sftp://beaglebone.lan
using root and blank password, and transfer the file across. Then...
tar xfvz ejdk-8-fcs-b132-linux-arm-vfp-hflt-03_mar_2014.gz
export JAVA_HOME=/usr/java/ejdk1.8.0/linux_arm_vfp_hflt/jre/
export PATH=$PATH:/usr/java/ejdk1.8.0/linux_arm_vfp_hflt/jre/bin/
...and add last two lines at ~/.profile set upon boot
Eitherway, you should get something like this in the end:
java -version
java version "1.8.0"
Java(TM) SE Embedded Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Embedded Client VM (build 25.0-b70, mixed mode)
Build 1.8.0-b132 is the lates manual one, and build 1.8.0_06-b23 the repository one.
3) Install Openhab
Openhab is very well organized as a community & java opensource project. They have debian builds/repo, and they use cloudbees for continuous integration.
https://github.com/openhab/openhab/wiki/Linux---OS-X
https://openhab.ci.cloudbees.com/job/openHAB/
That means it should be very easy to install OpenHab it in BBB/Debian, without having to do any manual stuff.
echo "deb http://repository-openhab.forge.cloudbees.com/release/1.5.0/apt-repo/ /" > /etc/apt/sources.list.d/openhab.list sudo apt-get update apt-get install openhab-runtime
Thats all :-)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
openhab-runtime
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
10 not fully installed or removed.
Need to get 37.5 MB of archives.
After this operation, 42.0 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
openhab-runtime
Install these packages without verification [y/N]? y
Get:1 http://repository-openhab.forge.cloudbees.com/release/1.5.0/apt-repo/ openhab-runtime 1.5.0 [37.5 MB]
Of course, you need to select some bindings, e.g:
apt-get install openhab-addon-binding-http
apt-get install openhab-addon-binding-ntp
apt-get install openhab-addon-persistence-exec
apt-get install openhab-addon-persistence-logging
apt-get install openhab-addon-persistence-rrd4j
You will wanna change the OpenHAB's jetty webserver port in /etc/default/openhab since by default its HTTP_PORT=8080, and Debian has already a proxy service there. (e.g. change to 9090)
nano /etc/default/openhab
You may start now the openhab service
/etc/init.d/openhab start
[ ok ] Starting openhab (via systemctl): openhab.service.
service openhab status
find / -name openhab
/var/log/openhab
/var/lib/openhab
/etc/init.d/openhab
/etc/openhab
/etc/default/openhab
/usr/share/openhab
Unfortunately openhab spreads on the above directories, (vs installing it manually from a zip, which keeps everything in one place)
If you want to replicate the demo you can download/extract the demo zip in /usr/share/openhab
If something is wrong you will need to see the log: /var/log/openhab/openhab.log
I will post more details on OpenHab on a future post, once I have some incoming sensor data.
4) Problems encountered
A) Upgrading
I always have the urge to upgrade stuff to their latest version, but maybe this is not such a good idea. Here is why:
sudo apt-get update
Fetched 20.1 MB in 48s (419 kB/s)
sudo apt-get upgrade
90 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 63.7 MB of archives.
After this operation, 264 kB of additional disk space will be used.
....
and got a couple of upgrade errors like:
dpkg: error processing apache2 (--configure):
dependency problems - leaving unconfigured
Setting up libdpkg-perl (1.16.15) ...
Setting up dpkg-dev (1.16.15) ...
Processing triggers for ca-certificates ...
Updating certificates in /etc/ssl/certs... 18 added, 5 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Errors were encountered while processing:
rsyslog
openssh-server
dbus
dbus-x11
hostapd
apache2.2-common
apache2-mpm-worker
apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
Restoring OS
So I guess, its better if you avoid upgrading, unless you want to dig deeper into what's happening.
btw, here are the images in case something goes wrong, or if you wanna try via an microSD card
http://beagleboard.org/latest-images
To restore BBB to original state, download the emmc debian image, sector-write it on an microSD, and boot BBB with S2 button pressed.
Note:If all 4 leds flash together, try again, it should not be like that. (Its a emmc write error)
I flashed SD card again, tried everything from start, and copy finished in ~10min)
B) Debian default approach will not install java:
I could not install java the straightforward Debian way.
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/Release Unable to find expected entry 'main/binary-armel/Packages' in Release file (Wrong sources.list entry or malformed file)
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/wheezy/main/source/Sources 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/wheezy/main/binary-armel/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/wheezy/main/binary-armhf/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
root@beaglebone:~# apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package oracle-java8-installer
C) Openhab ver 1.5.1 via deb repository does not seem to work on BBB
Latest stable release of openhab is ver 1.5.1. Unfortunately I could not start the service on BBB neither could I find out what was wrong.
More details here: https://github.com/openhab/openhab/issues/1690
They will release version 1.6 in the next few days, so I will upgrade to that version one way or another (via deb repository or manual "zip")
Next post:[Air ex Machina] #05 Lost in the sensors