Alternatives for the default IoT Edge VM based on Ubuntu 16.04

In a recent blog, I showed how to set up an Azure IoT Edge Virtual Machine. These VMs are great for testing your IoT platform with ‘actual’ gateways.

This default, recommended, Azure VM is based on 16.04 LTS version of Ubuntu:

This is still a great solution but just this month, Microsoft announced .Net Core 3.1. This is the next long-term supported (LTS) release.

The current IoT Edge is based on .Net Core 2.1, the current LTS version. That’s why sourcecode, specifically written in .Net Core 2.2, was not able to be used in the Module templates.

So it’s safe to assume, that in the near future IoT Edge will have an upgrade towards .Net Core 3.1.

The release blog came with this little note with a rather big impact:

Note: Please ensure that .NET Core 3.1 ARM64 deployments use Linux kernel 4.14 version or later. For example, Ubuntu 18.04 satisfies this requirement, but 16.04 does not.

So the current VM will not last very long anymore. You will need a new VM template, based on eg. Ubuntu 18.04.

Note: current IoT Edge Gateways rolled out with the Ubuntu 16.04 OS in test, acceptance or even production situations have te be upgraded soon to before the IoT Edge Runtime can be upgraded. So check the operating systems that come with the Industrial PCs you buy from your hardware vendor.

Let’s see how to start with Ubuntu 18.04 LTS on a VM.

Upgrading current version

One posibility is running an upgrade command:

sudo apt dist-upgrade

But I have eperienced that this could take hours to finish. Just depricating the current VM and setting up a new one takes minutes.

Ubuntu 18.04

Getting your hands on a Ubuntu 18.04 LTS version is not that hard. A default version is already supported as VM:

This is an Ubuntu server version so you only have a shell prompt, no UI.

Just follow the installation and you are good. Make sure you choose the right VM size. One with vcpus is needed, you will run container virtualiation within a VM so a CPU supporting nested vistualization is key:

Tip: Are you aware of the new SPOT VMs? You can get a VM for a fraction of the regular price. But you are less in control about the life and death of your VM:

Once the VM is created, you need to install the Azure IoT Edge runtime on the VM.

// These are commands for Ubuntu 18.04

curl https://packages.microsoft.com/config/ubuntu/18.04/multiarch/prod.list > ./microsoft-prod.list

sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/

sudo apt-get update

sudo apt-get install moby-engine

sudo apt-get install moby-cli

sudo apt-get update

sudo apt-get install iotedge

sudo nano /etc/iotedge/config.yaml

// fill in the security credentials for this device and save

sudo systemctl restart iotedge

And you are done. You are now on par with the logic in the previous version.

I have added a few extra steps in case you are interested in a Linux with a desktop.

Do you need a UI?

By now you should be able to access the VM using a Serial Console (SSH).

But I recently had to run a visual application on Ubuntu. So a console was not good enough, I needed a RDP session to connect to the UI desktop and the visual application.

Microsoft has great documentation on deploying the XFCI on your Ubuntu VM. Once deployed, install XRDP too. You then can login into your VM with a desktop using a RDP session:

[ placeholder for the browser installation. See next paragraph ]

sudo apt-get update
sudo apt-get install xfce4

sudo apt-get -y install xrdp
sudo systemctl enable xrdp

echo xfce4-session >~/.xsession

sudo service xrdp restart

But this documentation is missing one thing, XFCI will be missing a browser. So install a browser like FireFox before you install XFCI:

[ Execute these commands at the previous placeholder ]

sudo apt-get update
sudo apt install firefox

This is all you need to get started with Ubuntu using a UI.

Note: be aware that opening outbound ports for SSH or RDP is not recommented (or better: it’s insecure) except when you know what you are doing. As an alternative, check out Azure Bastion.

Conclusion

So moving over to Ubuntu 18.04 LTS is not that hard.

We have a second solution for creating an IoT Edge gateway based on an Azure VM. and this new VM is ready for the next generation of IoT Edge.

Een gedachte over “Alternatives for the default IoT Edge VM based on Ubuntu 16.04

Reacties zijn gesloten.