Skip to content

Instantly share code, notes, and snippets.

@Nolan-Walker
Last active November 25, 2021 20:50
Show Gist options
  • Save Nolan-Walker/440ff7c7ac28199258e6af05c6025d9c to your computer and use it in GitHub Desktop.
Save Nolan-Walker/440ff7c7ac28199258e6af05c6025d9c to your computer and use it in GitHub Desktop.
CONFIGURATION OF THE MOXA UC-8112-MET GATEWAY FOR INTEGRATION WITH SCADA SYSTEM AND FIELD DEVICES IN THE OIL & GAS INDUSTRY (MAY APPLY TO OTHER PROCESS INDUSTRIES AS WELL)
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#CONFIGURATION OF THE MOXA UC-8112-MET GATEWAY FOR INTEGRATION WITH SCADA SYSTEM AND FIELD DEVICES IN THE OIL & GAS INDUSTRY (MAY APPLY TO OTHER PROCESS INDUSTRIES AS WELL)
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------
#Author: Nolan Caissie | nolancaissie.ece@gmail.com | 27/03/2020
#---------------------------------------------------------------
#The following document provides the necessary information to install ThingsPro2 and Node-Red on the Moxa UC-8112-MET. This should work with other Moxa edge computers running Linux Debian 9 (or possibly later debian-based distros).
#The 5 part tutorial on the subject (recommended) is located at: https://www.youtube.com/playlist?list=PLqM5bz4H7e4t_iOdId9cCQrjlTRlbSI1C
#
#-----------------------
#CONNECTING TO THE MOXA:
#-----------------------
#
#NOTE: commands and login info will not work if unecessary white space is included
#
#SSH into moxa using putty
#user: moxa
#pwd: moxa
#
#NOTE: sudo command not required when running as root
#NOTE: ~& is used to indicate a linux command and is not part of the command
#
#Navigate to main user directory with:
#~& cd ~
#
#Make sure moxa is updated to Debian 9 (Debian 8 Jessie will not work with Node-red anymore)
#Type the following to check Debian version:
#~& hostnamectl
#
#NOTE: Moxa must be connected to the internet to install Node-Red
#I connected to the internet via a bridged-WAN DHCP server I made on a RaspberryPi - You can do this with any bridged/unbridged internet connection to the ethernet port.
#
#To configure Moxa for DHCP so it can access the internet (only relevant if not installing ThingsPro2 first) type the following commands:
#~& cd /etc/network
#~& sudo nano interfaces
#you may be prompted for a password so enter password:moxa
#comment out all static IP information for eth0 (you may also change the IP for eth1 here if you would like)
#add the following line to the file (also remove extraneous static IP info):
#iface eth0 inet dhcp
#press Ctrl-X to exit; when prompted to save type y
#reboot the moxa using the following command:
#~& sudo reboot
#TYPE THE FOLLOWING COMMAND IN THE TERMINAL OF SSH CONNECTION TO MOXA TO VIEW IP ADDRESSES:
#~& sudo ifconfig
#CONFIRM INTERNET CONNECTION BY PINGING GOOGLE WITH COMMAND:
#~& sudo ping 8.8.8.8
#IT APPEARS THAT THINGSPRO OVERWRITES THIS SO GO TO THINGSPRO AND FOLLOW THESE STEPS TO CHANGE ETH0 TO DHCP IF THINGSPRO IS INSTALLED (SEE BELOW FOR INSTALL INFORMATION):
#1. LOGIN AS ADMIN - SEE BELOW
#2. CLICK ON THE LEFT BAR AND GO TO NETWORK
#3. CLICK ON ETHERNET
#4. CLICK ONO THE BUTTON ON THE RIGHT BESIDE REFRESH
#5. CLICK ON SETTINGS
#6. CHANGE ETH0 TO DHCP
#THE EFFECT SHOULD TAKE PLACE IMMEDIATELY
#TYPE THE FOLLOWING COMMAND IN THE TERMINAL OF SSH CONNECTION TO MOXA TO VIEW IP ADDRESSES:
#~& sudo ifconfig
#CONFIRM BY PINGING GOOGLE WITH COMMAND:
#~& sudo ping 8.8.8.8
#
#-----------------------------------
#INSTRUCTIONS FOR THINGSPRO INSTALL:
#-----------------------------------
#
#NOTE: Must install ThingsPro before Node-REd!!! This is due to clashing dependencies with NPM (node package manager).
#To install ThingsPro just SFTP into Lan2 (192.168.4.127) using WinSCP on Windows OS to copy thingspro .tgz (downloaded from moxa website for UC-8100-ME-T) over to moxa's main user directory (/home/moxa/).
#NOTE: ThingsPro 2 section on moxa website has all relevant documents and downloads. You can check to see compatibility on the ThingsPro datasheet.
#NOTE: use command kversion or kversion -a to see the firmware version on the moxa
#NOTE: To upgrade firmware you must use serial console port not regular serial ports
#
#Run the following command to extract the .tgz file:
#~& tar -xzvf file.tar.gz (extension may be .tgz)
#
#Run the following command:
#~& sudo bash thingspro.sh install
#
#Once this is complete (takes 20-30 mins), navigate to thingspro GUI by pointing your browser (may need google chrome) to http://192.168.4.127
#Click "GET STARTED"
#ThingsPro login info:
#Username: admin@moxa.com
#Password: admin1234
#For the root account, use the following information:
#Username: root@moxa.com
#Password: root1234
#
#Side notes on some commands to confirm install and drive space:
#use following command to see drive space:
#~& df -h
#
#use following commands in respective order to see linux version, firmware version, thingspro version, npm version, node-red version, nodejs version (some of these will only apply after node-red install)
#~& hostnamectl
#~& kversion
#~& pversion
#~& nodejs -v
#~& npm -v
#~& node-red -v
#
#----------------------------------
#INSTRUCTIONS FOR NODE-RED INSTALL:
#----------------------------------
#
#NOTE: If ThingsPro2 fails to install you may need to run the next couple of commands to update package list / upgrade the packages (then try ThingsPro install again)
#you may be prompted to enter in password:moxa for the following commands
#
#Update package list
#~& sudo apt-get update
#Upgrade new versions of packages
#~& sudo apt-get upgrade
#
#Install git just in case (should be unessesary here)
#~& sudo apt-get install git -y
#
#Install curl to transfer data from servers (i.e. download scripts and programs etc)
#~& sudo apt-get install curl -y
#verify install by typing curl command (it should say curl: try 'curl --help' or 'curl --manual' for more information)
#
#This will install the essential tools for building most other packages from source (C-C++ compiler, libc, and make)
#~& sudo apt-get install build-essential
#
#I used these commands but I don't believe they contributed to install as these commands should have been replaced by the following bash curl below. The last command resulted in an error.
#~& apt-get install nodejs -y
#~& update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100
#~& curl https://www.npmjs.com/install.sh | sh
#
#
#Now install Node.js (script is provided to install node.js npm and node-red onto Debian os - can also be used to upgrade an existing install
#This script will:
#remove the pre-packaged version of Node-RED and Node.js if they are present
#install the current Node.js LTS release using the NodeSource. If it detects Node.js is already installed from NodeSource, it will ensure it is at least Node 8, but otherwise leave it alone
#install the latest version of Node-RED using npm
#optionally install a collection of useful Pi-specific nodes
#setup Node-RED to run as a service (i.e. run on start-up when moxa is turned on, or rebooted) and provide a set of commands to work with the service
#NOTE: This command can also be used to update-nodejs-and-nodered
#view the script by opening the github link
#
#Do not use sudo for the follwing command:
#~& bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
#
#Run the following command to have node-red run as a service (i.e. run on start-up when moxa is turned on, or rebooted). Remove sudo command if logged in as root user.
#~& sudo systemctl enable nodered.service
#Run the following command below to disable node-red as a service. Remove sudo command if logged in as root user.
#~& sudo systemctl disable nodered.service
#
#use this command to start Node-RED. Typing Ctrl-Z will close node-red in the terminal but it will remain running in the background
#~& node-red-start
#
#use this command to stop node-red
#~& node-red-stop
#
#Connect to Node-Red GUI by pointing your browser at:
#http://<hostname>:1880
#
#------------------------------------------------------------------------------------------------------------------------------------------------------------------
#The following tokens were taken from ThingsPro - they may be unessesary but once issued by ThingsPro they will not be visible again and must be saved by the user.
#------------------------------------------------------------------------------------------------------------------------------------------------------------------
#token from thingspro
#$2b$10$TJiB7FV3SI5w7VTdP8Ct8ubnL5huPqEpgaq9DN5Kq.YFdXt3VhwTC
#pre-existing token
#$2b$10$fLh/HDVumyR/rxxEPeOL..JifzVIp2zEaCkV1uwyYoItMoCEVaWpS
#
#----------------
#Acknowledgements
#----------------
#The folks at Node-Red for the install script (https://nodered.org/docs/getting-started/raspberrypi)
#Moxa tech support (https://www.moxa.com/en/support)
#The NPM community (https://npm.community/)
#The Github community (https://github.com/node-red/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment