Skip to content

Latest commit

 

History

History

linux

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

OPC UA IIoT StarterKit – Setup Ubuntu Environment

Overview

  1. Install and Configure MQTT Broker
  2. Install and Configure .NET Core
  3. Build StarterKit Code

These steps explain how to set up an insecure broker for testing. A broker used in production applications would need to have TLS enabled and some sort of client authentication.

Install Mosquitto Broker with these commands:

sudo apt update
sudo apt install mosquitto

Download Java 8 from here. For Ubuntu 64-bit the download is the "Linux x64 Compressed Archive".

cd ~/
tar -xvf jre-8u291-linux-x64.tar.gz 

Download mqtt-spy from here.

mkdir ~/mqtt-spy
cd ~/mqtt-spy
~/jre1.8.0_291/bin/java -jar mqtt-spy-1.0.0.jar 

To connect to a broker using mqtt-spy:

  • Create a connection to the broker;
  • Subscribe to all topic (enter ‘#’ as the topic name);
  • Publish to a text topic and verify the response was received.

Install Visual Studio Code:

sudo apt install code

Manually download Visual Studio Code from https://code.visualstudio.com/ if necessary.

Install the following extensions (select extensions icon on right side toolbar):

  • C#

Install .NET Core SDK:

sudo snap install dotnet-sdk --classic

Test installation:

mkdir helloworld
cd helloworld/
dotnet new console
dotnet build
dotnet bin/Debug/net6.0/helloworld.dll 

If all is good the following output should be printed:

Hello World!

Fetch code from GitHub:

cd ~/
git clone --recursive https://github.com/OPCFoundation/UA-IIoT-StarterKit.git

Build code:

dotnet build .\UA-IIoT-StarterKit.sln

Run code

cd ~/UA-IIoT-StarterKit/build/bin/Debug/UaMqttPublisher/net6.0
dotnet UaMqttPublisher.dll --help

The following output should be produced:

An application that produces OPC UA PubSub messages sends them to an MQTT broker.

Usage: UaMqttPublisher [command] [options]

Options:
  -?|-h|--help  Show help information.

Commands:
  publish       Produces OPC UA PubSub messages sends them to an MQTT broker.

Run 'UaMqttPublisher [command] -?|-h|--help' for more information about a command.

Running the MQTT Publisher
Running the MQTT Subscriber