Sunday, January 15, 2017

BeagleBone Green Wireless as a LAMP Server

This post demonstrates how to configure a BeagleBone Green Wireless (BBGW) first for WiFi tethering and then as a LAMP server.  For context, I have an IoT project (not described here) which uses the BBGW for data collection which can be examined using a web browser.

Flash your BBGW w/the latest image.  I am using "Jessie for SeeedStudio BeagleBone GreenWireless" (bone-debian-8.6-seeed-iot-armhf-2016-11-06-4gb.img).

After updating the BBGW image, log in to configure WiFi using connmanctl(1), there are example instructions in /etc/network/interfaces.

Now that you have internet connectivity, update the software using apt-get(8):
  • "apt-get update"
  • "apt-get upgrade"
Perform a gratuitous reboot for luck.

When the BBGW returns from reboot,  you should detect a fresh WiFi SSID in the form "BeagleBoneXXXXXX" where XXXXXX are integers.  This SSID was created by wifidog which is part of the BBGW Debian distribution.  

I don't need a captive portal for my purposes, so login to BBGW and invoke "apt-get remove wifidog-gateway" then reboot.

Now when the BBGW returns from reboot, you should detect a fresh WiFi SSID in the form "BeagleBone-XXXX" where XXXX are hex values representing part of the MAC address.

/etc/default/bb-wl18xx contains some tweakable parameters, such as SSID base.

/tmp/hostapd-wl18xx.conf is the actual hostapd(8) configuration file, note the wpa_passphrase "BeagleBone"


SoftAp0 is the WAP device:
root@beaglebone:/etc/default# ifconfig SoftAp0
SoftAp0   Link encap:Ethernet  HWaddr b0:d5:cc:ff:65:be  
          inet addr:192.168.8.1  Bcast:192.168.8.255  Mask:255.255.255.0
          inet6 addr: fe80::b2d5:ccff:feff:65be/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5220 errors:0 dropped:3 overruns:0 frame:0
          TX packets:703 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 

          RX bytes:1328274 (1.2 MiB)  TX bytes:122059 (119.1 KiB)

From your laptop, connect to the BeagleBone device just as you would any other WAP.

Apache is configured for port 8080.  Verify you can connect to apache2(8) by visiting http://192.168.8.1:8080/ with your browser.

Assuming happy browser response, you now have a BBGW ready for a LAMP stack.  Note that the BBGW still has internet connectivity through wlan0 as configured earlier.

Now install mysqld(8) by invoking "apt-get install mysql-server" - when finished, verify a happy installation using mysql(1) and ensure you can at least login to mysqld(8).

Now install PHP, et al by invoking "apt-get install php5 libapache2-mod-php5 php5-mysql" - when finished, verify a happy installation by placing the usual phpinfo script into /var/www/html and visiting w/a browser.

1 comment: