Setting Up UMich Sensors¶
Note: this wiki page is obsolete. See #68 for an update.
If you have a gateway box that does not have the Michigan gateway code already running and you do need that interface (BLE for BLEEs, Blinks, and PowerBlades), you'll need to set up the gateway machine first. These instructions assume you are starting with an out-of-the-box Beaglebone and you are installing all software from source. If you are not installing on a Beaglebone, you must be on a system running systemd
for system startup. Ubuntu 16.04 works, but Ubuntu 14.04 does not.
If you are installing software from packages, most of these instructions do not apply. However, always do the first section (Setting up the OS) on Beaglebones before putting the gateway on the open network.
Setting up the OS¶
Beaglebones come with a stripped down version of Linux. They are designed for hobbyists,
and are not set up to be secure. Step one is to update some of the security settings.
- Set a root password. BBBs come with no root password, which means that anyone can log in once you are on the network. Since there is no need for root to have a password, you can use
passwd -l root
to do this. You'll still be able tosudo
to root, but not log in directly. Disable root logins over ssh. You should not have to log in as root. To change this, edit
/etc/ssh/sshd_config
as follows:PermitRootLogin yes⇒ PermitRootLogin no
PermitEmptyPasswords⇒ PermitEmptyPasswords noChange the password for account
debian
. Every Beaglebone comes with the same password as shipped. It is essential that you change this password before connecting to the network. Check with Ken, Eric, or Nitesh for the standard password for Berkeley gateways.
Getting the GDP code¶
The script to set up the Michigan gateway code is located as part of the GDP distribution (at least for now; it may get moved to a separate repository in the future). You'll need to get the source code before proceeding. See Repo_access for more information.
You shouldn't need to compile the GDP code unless you need it for other reasons, but you will need the setup scripts.
Setting up the Michigan code¶
You should be able to skip this section if you are running on a Beaglebone with the Michigan Urban Heartbeat Kit code preinstalled. On other systems ...
Run the script gdp/uhb/mqtt-gateway/setup-uhk-gateway.sh
. If you are running on a Beaglebone, the Michigan scripts assuming you are installing the code into /home/debian/gateway/software
, but this script allows you to move the it elsewhere. You can specify the installation directory as an argument on the command line, e.g.,
sh setup-uhk-gateway.sh /usr/local/uhk/gateway
If you aren't on a Beaglebone, the install path defaults to /usr/lib/uhk
.
This script will install all required packages and system startup scripts.
Reboot the machine and check results¶
The easiest way to make sure everything you need is running is to reboot the system. When you start up you should see several new daemons running, including mosquitto
, ble-address-sniffer-mqtt
, ble-gateway-mqtt
, and gateway-mqtt-topics
.
Dirty Details of the Beaglebone¶
If you're using the scripts you probably won't need these, but just in case:
- Make sure root login is disabled for ssh and the root password is disabled. If you don't do this you might as well go home.
- Make sure that the
debian
account does not have the default password (temppwd
). If you don't this the system will be infiltrated and you'll have to re-image the disk. - Make sure
/etc/mosquitto/mosquitto.conf
contains the linelog_type none
. If you don't do this the logs fill up the (very small) disk quickly. Make sure that all the necessary services are installed, enabled, and working. You should be able to determine this using
systemctl list-units
Check in particular that the services
mosquitto
,ble-advertisements
, andble-gateway-mqtt
are running; these are the services necessary to get BLE data into MQTT and from there into the GDP (systemctl list-units
should show statusloaded active running
). Other services you may see includeadv-gateway-ip
,ble-address-sniffer-mqtt
,gateway-mqtt-topics
,gateway-publish
, andgateway-server
.