Installing ThingSpeak on EndeavourOS latest

Introduction

ThingSpeak is an open-source IoT analytic platform that allows you to collect, analyze and act on data from sensors and other IoT devices. In this tutorial, we will walk you through the process of installing ThingSpeak on a fresh install of EndeavourOS 2021.08.09.

Requirements

Step 1: Update the System

Updating the system is the first step before installing any software packages as it ensures that the system has the latest security patches and program updates.

sudo pacman -Syu

The command may prompt you to enter your password. Type it and press Enter.

Step 2: Install the Required Packages

We need to install a web server (Apache), PHP, and a Database Management System (MariaDB) to run ThingSpeak on EndeavourOS latest. Run the commands below to install the required packages.

sudo pacman -S apache php mariadb

Next, enable and start the services to run at boot time using the following commands.

sudo systemctl enable mariadb
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl start httpd

Step 3: Set up Database and User for ThingSpeak

We need to create a database for ThingSpeak and a user account that can access the database.

Login to the MariaDB shell as the root user:

sudo mysql -u root

When prompted, enter the root password.

Create a Database

Run the following commands to create the ThingSpeak database.

CREATE DATABASE thingspeak;
GRANT ALL PRIVILEGES ON *.* TO 'thingspeak_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Use your preferred database name and a secure password for the user account.

You can now exit the MariaDB shell.

exit

Step 4: Install ThingSpeak

We will clone the ThingSpeak source code into the /opt directory.

sudo git clone https://github.com/iobridge/thingspeak.git /opt/thingspeak

Step 5: Configure ThingSpeak

ThingSpeak requires certain PHP modules to work correctly. We will enable them by modifying the php.ini file.

Open the php.ini file with your favorite text editor.

sudo nano /etc/php/php.ini

Find the line that starts with ;extension=mysqli, and remove the semi-colon to uncomment it.

Find the line that starts with ;extension=php_fileinfo.dll, and remove the semi-colon to uncomment it.

Save and close the file.

Step 6: Configure Apache

We need to create an Apache configuration file for ThingSpeak.

Create a ThingSpeak configuration file in the /etc/httpd/conf/extra/ directory.

sudo nano /etc/httpd/conf/extra/thingspeak.conf

Add the following content to the file:

<VirtualHost *:80>
   DocumentRoot "/opt/thingspeak/public"
   ServerName thingspeak.local
   <Directory "/opt/thingspeak/public">
      AllowOverride All
      Require all granted
   </Directory>
   ErrorLog "/var/log/httpd/thingspeak_error.log"
   CustomLog "/var/log/httpd/thingspeak_access.log" combined
</VirtualHost>

Save and close the file.

Next, enable the required Apache modules by running the following command.

sudo a2enmod rewrite

Restart Apache for the configuration to take effect.

sudo systemctl restart httpd

Step 7: Access ThingSpeak

Open a browser window and enter http://thingspeak.local in the address bar. You should see the ThingSpeak welcome page.

Follow the steps to register and log in to ThingSpeak.

Conclusion

You have successfully installed and set up ThingSpeak on EndeavourOS latest. You can now use the platform to collect, analyze, and take action on IoT data from your sensors and other IoT devices.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!