Skip to main content

Applications - Debian

As per specific need and requirement you can install any Debian supported open-source platform.
i.e. webmin for web-UI based device and system management, node-red for block programming and openPLC etc.


Node-RED

Node-RED is a digital flowchart tool for connecting different online services and devices. It helps you easily create automation and data-handling processes without needing to write a lot of code, you can use the web interface to design even very complex flows for automation control.

Prerequisites

You need to install the required packages.

  • curl
  • bash

You can find the instructions here.

Installing is not suggested to done as root user, this kind of installations are instructed to be performed under normal user only, but in case if your Node-RED development will need any root user permissions in future irrespective of any process/development, we suggest to must follow one of below methods.

  • Install Node-RED using root user.
  • If Node-RED is installed under normal user, replace normal user in Node-RED service with root user.

Installation of Node-RED

First, update the repositories.

sudo apt-get update

Enter below command to start node-red installation process:

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

If any error encounters During the installation process, i.e. "user is not in sudoer group", either give sudo privileges' to normal user or you can try to run whole process as root, but that can be done only on specific requirements.

it will ask for various questions while installation startup, all of them are answered with a "Y", But enter "N" when it asks for 'Raspberry PI spec node'.

AG-1621-apps-nodered-1.png

 Wait for above process to be finished! 

AG-1621-apps-nodered-2.png

As shown below go through warnings and exec "sudo chown root:root ~/.node-red/settings.js" as suggested.

At the end, the installer will ask if we want to secure the instance. Hence it is necessary secure it, enter the username and password for the Node-RED panel as per convenience. (Ref image below)

AG-1621-apps-nodered-3.png

For sack of avoiding any hurdles go with basic/default settings, But must apply password.

Remember to make your password long and complicated enough. The security of your gateway depends on it.

After installation, you need to execute below command:

sudo node-red-pi --max-old-space-size=256

Node-RED will start and will be available on port "localhost:1880".
Open in any browser of host system connected to same IP range or in same networking area.

AG-1621-apps-nodered-login.png

It will prompt for "username/password", feed with the same credentials configured back while installation process.


Node-RED AutoStart

In the last step node-red was started after manual command executed in CLI,
In order to automatically start node-red on gateway startup, it needs to be entered into the startup system. To do so, execute below commands:

sudo npm install pm2@latest -g

If ask to " run `npm fund` for details", do the same and process for next command:

sudo pm2 start /usr/bin/node-red --node-args="--max-old-space-size=256" -- -v

You will get below output after command executed, check for user in table, if not "root", need to change user to "root" from normal user.

AG-1621-apps-nodered-PM2-1.png

If user is "root" proceed to below command or else skip this step.

pm2 save
pm2 startup

For changing user from "normal user" to "root" for node-red startup, follow below steps:

sudo pm2 start node-red -u root
sudo pm2 save

AG-1621-apps-nodered-PM2-2.png

If any warning shown on screen use "--force" flag, i.e. "sudo pm2 save --force"

Must check the symlink created should have service "pm2-root.service"

sudo pm2 startup
sudo pm2 save

Reboot the device, for cross checking and verifying proper installation.
once rebooted, check below command:

ps -aux | grep pm2

AG-1621-apps-nodered-PM2-3.png

Check either it's daemon running over root or not, if not you might have misguided somewhere and make mistake while installation, please refer again and install.

Open "localhost:1880" and start node-red.


Webmin

The Webmin administration panel, which allows you to administer the server via the web interface, can be installed on the Gateway. The Webmin panel has many functions related to web hosting and one of them is updating your Linux packages. To install Webmin you need to connect a keyboard, mouse and monitor via USB HUB and it is necessary to have access to the Internet.

Prerequisites

You need to install the required packages.

  • curl
  • bash

You can find the instructions here.


Webmin installation

Start the gateway and launch the terminal. Enter the commands below.

curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
sh setup-repos.sh

AG-1621-apps-webmin-1.png

Above script will automatically setup repository and install needed keys on system, also it will provide webmin package for installation.
execute below command for installation, If confirmation is required during installation, enter 'y'. Then type the below commands:

apt-get install webmin --install-recommends

The entire Webmin system should install without errors.

Once installation is successful you can access webmin on port 10000 over localhost IP, in any browser.
i.e. : http://localhost:10000 or http://192.168.10.174:10000

if any privacy error appears continue with Proceed to <localhost_IP> (unsafe)

The login panel will open and pop-up for credential will appear. you need to provide system's credentials here. i.e. user/pass : atreyo/12345

AG-1621-apps-webmin-login.png

Once you sign in with password, below interface will open and it's a dashboard of webmin.

AG-1621-apps-webmin-load.png

AG-1621-apps-webmin-dasheboard.png

With Webmin we can update system packages, restart the gateway, change user and network settings and much more. For more about the Webmin panel visit Webmin Docs


OpenPLC

OpenPLC is an open-source Programmable Logic Controller that is based on an easy to use software. It is the first fully functional standardized open source PLC, both in software and in hardware. The OpenPLC project was created in accordance with the IEC 61131-3 standard, which defines the basic software architecture and programming languages for PLCs.

OpenPLC is mainly used on industrial and home automation, internet of things and SCADA research.

Installation of OpenPLC

To install OpenPLC on AG-1621 log in via SSH or if you are using the Webmin panel go to Tools > terminal and type the following commands. Remember that the whole installation and compilation of the program may take up to an hour of your time. 

sudo apt-get install git

Once installed, type the following command:

git clone https://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh rpi

The whole installation process will take some time. When it finishes it will display "Compilation finished successfully!" in the terminal. After rebooting the system, OpenPLC will start automatically.

To use in-development capabilities, checkout the development branch (git checkout development) prior to running install.sh.

Starting OpenPLC

After restarting, enter the gateway IP and port 8080 in the browser address window. For example, 192.168.10.60:8080

The login window will open. The default username and password is:
login: openplc
password: openplc

AG-1621-apps-openplc-login.png

After logging in, we go to the home screen.

AG-1621-apps-openplc-dashboard.png

To learn how to use OpenPLC you can read on the site:
https://openplcproject.github.io/