ThingSpeak server is an open data platform and API for the Internet of Things that enables you to collect, store, analyze, visualize, and act on data from sensors. More about ThingSpeak can be read here.

This article describes how to make standalone Thingspeak server installation on Ubuntu 14.04.

1. Make an initial update of the system

sudo apt-get update

2. Installation of all necessary packages

sudo apt-get -y install build-essential git mysql-server mysql-client libmysqlclient-dev libxml2-dev libxslt-dev libssl-dev libsqlite3-dev

For Ubuntu 14.04 above command will install all necessary packages. For some older versions of Ubuntu, an extra command should be executed for git package installation.

sudo apt-get git-core

3. MySQL pass

If you haven’t had MySQL installed in advance, you will be required to enter a new password for administrative rights on the MySQL database.

ThingSpeak-server-i1-SQL-pass

4. Ruby installation

Download and installation time for those packages vary, depend on system hardware. Installation is made by following commands:

wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.gz
tar xvzf ruby-2.1.4.tar.gz
cd ruby-2.1.4
./configure
make
sudo make install
cd ..

ThingSpeak-server-i2-Ruby-isntall

ThingSpeak-server-i3-Ruby-install

5. Rails installation

echo “gem: –no-rdoc –no-ri” >> ${HOME}/.gemrc
sudo gem install rails

6. ThingSpeak installation

It is recommended that the installation of the following packages is done using normal user rights (no root privileges).

ThingSpeak-server-i4

Installation is made by following commands:

git clone https://github.com/iobridge/thingspeak.git
cp thingspeak/config/database.yml.example thingspeak/config/database.yml
cd thingspeak
bundle install
bundle exec rake db:create

Here the MySQL database access password will be required.

bundle exec rake db:schema:load

If the package installation was successful, the following message will be displayed:

ThingSpeak-server-i5

7. Launching the ThingSpeak server

ThingSpeak server can be launched by the following command:

rails server

ThingSpeak-server-6

After execution of above command, ThingSpeak server will be accessible at 0.0.0.0:3000 in the web browser:

ThingSpeak-server-7

Every activity of user will be displayed on the console.

To stop the server, use Ctrl+C in the console.

To launch the server, use:

rails server

ThingSpeak-server-8

8. Launching ThingSpeak server at start up

8.1. Creating a launching script

In order to launch ThingSpeak at start up, a short script must be created and added to the processes, which is launched at system start-up. This can be done with the following commands in the console terminal.

cd /home/USER/thingspeak
nano run.sh

In this case, the script is added to the folder, where ThingSpeak packages were downloaded. The string USER should be replaced with a real user name of user installed the ThingSpeak server. For example, if the username is tele the command should be

cd /home/telem/thingspeak
nano run.sh

After the last command, an empty document run.sh will be created. In this document the following command should be saved:

#!/bin/bash
cd /home/USER/thingspeak && pwd && rails server webrick

ThingSpeak-server-9

Ctrl+X saves the document. If the ThingSpeak is installed in a different directory, it should be specified here. The command, written in this way, means that the process is located in directory /home/USER/thingspeak, and this process will launch at system start-up.

8.2. Compiling the script

The already created script is compiled with following command:

chmod +x /home/USER/thingspeak/run.sh

8.3. Adding the script to the start-up processes

Then the script should be added to the process launched by the operating system start up. This happens by adding a record in one of the configuration files, which has to be opened, changed and saved with administrative (sudo) rights

cd /etc
sudo nano rc.local

After executing these commands, the configuration file will be opened. Just before the last line (exit 0) following record should be added:

sudo –u USER sh /home/USER/thingspeak/run.sh &

ThingSpeak-server-10

Ctrl+X saves the document.

This document describes the steps of installing a ThingSpeak server. The commands used were applied to the operating systems Ubuntu 14.04.
The installation is done in directory /home/thingspeak of user telem.

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.