I recently went through a rebuild of my OH2 server, which I run on a $9 CHIP from Next Thing Computing. I’ve been running OH/OH2 on this hardware for about a year now, and it’s been great. From my perspective, the CHIP has a few advantages over the Raspberry Pi (I’ve used both):
- It’s only $9!
- Trivial to flash with Chrome app
- USB power connection doubles as a serial modem (makes bootstrapping a snap, as we’ll see)
- On-board WiFi and Bluetooth
Now that I’ve been through the build process a few times, I thought I would document the steps here in case anyone else would like to do the same. Note the the serial connection steps will vary by your host OS; in my case I’m using a Mac with OS X.
So, to go from bare metal to a functioning OH2 server, follow these steps:
-
Visit https://flash.getchip.com/ in Chrome
-
Flash the CHIP with the latest headless firmware
-
Disconnect and reconnect the USB cable
-
ls /dev/tty.usb*
will give you the serial address of the CHIP, in the form of/dev/tty.usbmodem????
-
sudo cu -l /dev/tty.usbmodem???? -s 115200
will open a serial terminal connection -
Login as
root
, passwordchip
-
Run
nmtui
to activate WiFi and connect to your WLAN -
Confirm the CHIP’s IP address with
ifconfig
-
~.
will disconnect thecu
session -
If you don’t have an SSH key on your non-CHIP PC, generate one using
ssh-keygen -t rsa
-
Push your SSH public key to the CHIP with
cat ~/.ssh/id_rsa.pub | ssh root@CHIP-IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
-
Open an SSH session with
ssh root@CHIP-IP
-
Configure the Java and OpenHAB repositories
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
wget -qO - "https://bintray.com/user/downloadSubjectPublicKey?username=openhab" | apt-key add -
echo "deb https://dl.bintray.com/openhab/apt-repo2 stable main" | tee /etc/apt/sources.list.d/openhab2.list
- Add support for HTTPS repositories and update
apt-get install apt-transport-https
apt-get update
- Configure time zone and locales
dpkg-reconfigure tzdata
apt-get install locales
dpkg-reconfigure locales
- Upgrade components and install
apt-get upgrade
apt-get install oracle-java8-installer openhab2
-
If rebuilding, restore your configuration backup to
/etc/openhab2/
-
Start the OH2 service
systemctl enable openhab2.service
systemctl start openhab2.service
- Installation complete
That’s it! If you have any questions or run into any trouble, please let me know.