Installing Mako Server on Linkit Smart and Omega Onion2

The Linkit Smart and Omega Onion2 are similar, and you may use the same installation instructions for both devices.

The Mako Server for the LinkIt Smart 7688 enables developers to easily design advanced IoT solutions and to run general websites on the LinkIt Smart 7688.

LinkIt Smart 7688 is a $13 computer that runs the OpenWrt Linux distribution. LinkIt Smart 7688 includes an MT7688AN SoC, 128MB RAM, 32MB flash, and WiFi. The device is equipped with a microSD slot, a micro-USB host port, and a micro-USB port for 5V power input.

Before starting the installation process, power on the device, connect to its access point using a Wi-Fi enabled computer, browse to 192.168.100.1, and set a password. Setting a password lets you login to the device using SSH. When you are in the web interface, change the SSID name to something suitable for your project. Also check that you are using the latest firmware version.

The device initially operates in access point mode; however, for the Mako Server installation process, set it to station mode and connect it to your local network. This will make the Mako Server installation process much easier. You can set it back to access point mode, if needed, when the installation is complete.

When the device is in station mode, use an SSH client such as PuTTY and log in with username root and the password you set previously in the Web UI.

Install the Mako Server as follows:

LinkIt SmartOmega Onion2
cd /tmp/; wget makoserver.net/download/mako.MT7688.tar.gz; tar xvzf mako.MT7688.tar.gz; cp mako mako.zip /bin/;
cd /tmp/; wget makoserver.net/download/mako.onion2.tar.gz; tar xvzf mako.onion2.tar.gz; cp mako mako.zip /bin/;

You can now start the server from the command line. See the Mako Server command line guide for more information.

Installing Mako Server as a service (Linux daemon) on the device

Installing Mako as a service on the Linkit and Onion2 is similar to installing the Mako as a service on a standard Linux.

Start by downloading the Mako Server service script as follows:

cd /etc/init.d/; wget makoserver.net/download/scripts/mako.sh; chmod +x mako.sh;

The service script attempts to start the Mako Server in the /home/mako directory. The script also tries to run the server as the user 'mako'. Since we are using BusyBox, we must manually create /home/mako and manually create the Linux user mako as follows:

mkdir -p /home/mako; echo "mako:*:299:299:mako:/home/mako:/bin/sh" >> /etc/passwd; chown mako /home/mako;

You should now be able to start and stop the Mako Server as a background process from the command line:

/etc/init.d/mako.sh start /etc/init.d/mako.sh stop

Notice that the server is unable to open the default port 80 since this port is in use by the default web server (the server used to configure the network settings). The Mako Server will instead be listening on port 9357. If you want the Mako Server to listen on the default port, change the default servers port number to 8080, by using the Vi editor, as follows:

vi /etc/config/uhttpd

Use the Vi editor and change all occurrences of 80 with 8080 and 443 with 8443. See the Openwrt command line tutorial, section editing files, if you are new to the 'Vi' editor.

After editing the above file, restart the uhttpd server as follows:

/etc/init.d/uhttpd restart

Starting the Mako Server when Linux boots

Although you can start and stop the server from the command line, the server will not start if you reboot your Linux computer. For this to work, the following commands must be executed:

cd /etc/rc.d/; ln -s ../init.d/mako.sh S92mako; ln -s ../init.d/mako.sh K92mako;

Configuring Your First Application

At this point, you can instruct the Mako Server to load applications when it starts. Follow the tutorial "Installing Mako Server as a Service on Linux", section Configuring Your First Application. However, note that you do not have the 'su' command; thus edit the files as user root, followed by changing the file owner to 'mako'. The easiest way to do this is to execute the following command after any edit.

chown -R mako /home/mako

Project Example

We used a LinktIt Smart device to act as an access point and server solution for the Holiday Light Controller project.

LinkIt Smart provides an open access point and lets anyone with a phone or tablet control the connected light banks. The access point acts as a "network connection island", where the only connected clients are either the light controller banks or tablets/phones.

To replicate this project, start by installing the Mako Server as a Linux daemon, as explained above. Then, install the Light Controller app as follows:

cd /home/mako/; wget makoserver.net/apps/LightController/LightController.zip; echo "apps = {{ name='', path='LightController.zip', auth=true }}" > mako.conf; chown -R mako /home/mako; /etc/init.d/mako.sh restart

Use a browser, navigate to the IP address of the LinkIt, and set a username/password for the Holiday Light Controller App.

Use the original web server that should now be running on port 8080 and configure the LinkIt as an access point. Restart the device and read the Light Controller documentation for how to connect Light Controller banks to the LinkIt access point.