This guide will help you to install ThingsBoard IoT Gateway on Ubuntu 18.04 LTS / Ubuntu 20.04 LTS.
Prerequisites
- The minimum system requirements match official minimum requirements for the OS;
- Install Python version 3.7 or higher.
Step 1. Download the deb file
Download installation package.
1
wget https://github.com/thingsboard/thingsboard-gateway/releases/latest/download/python3-thingsboard-gateway.deb
Step 2. Install the gateway using apt
Install ThingsBoard IoT Gateway as package and run it as daemon uses the following command:
1
sudo apt install ./python3-thingsboard-gateway.deb -y
The deb package will automatically install the necessary libraries for the IOT Gateway to work:
- System libraries: libffi-dev, libglib2.0-dev, libxml2-dev, libxslt-dev, libssl-dev, zlib1g-dev, python3-dev, python3-pip.
- Python modules: importlib, importlib-metadata, jsonschema, pymodbus, lxml, jsonpath-rw, paho-mqtt, pyserial, PyYAML, simplejson, pyrsistent.
Step 3. Check gateway status
1
systemctl status thingsboard-gateway
You may notice some errors in the output. However, it is expected, since gateway is not configured to connect to ThingsBoard yet:
1
2
3
4
... python3[7563]: ''2019-12-26 09:31:15' - ERROR - mqtt_connector - 181 - Default Broker connection FAIL with error 5 not authorised!'
... python3[7563]: ''2019-12-26 09:31:15' - DEBUG - mqtt_connector - 186 - "Default Broker" was disconnected.'
... python3[7563]: ''2019-12-26 09:31:16' - DEBUG - tb_client - 78 - connecting to ThingsBoard'
... python3[7563]: ''2019-12-26 09:31:17' - DEBUG - tb_client - 78 - connecting to ThingsBoard'
Step 4. Configure the gateway
Now you can go to configuration guide to configure the gateway. In order for the changes to be saved, we need to restart the gateway.
1
systemctl restart thingsboard-gateway
Offline Build Version
The Offline Build is a special variant of the ThingsBoard Gateway package designed for installation and execution without internet access. Also, the offline build allows you to use any connector without installing dependencies in runtime. It contains all necessary dependencies bundled in advance, including:
- A prebuilt Python virtual environment.
- All required Python packages.
- The application wheel (
.whl
).
This ensures seamless deployment in air-gapped, offline, or restricted-network environments.
Example of usage
A company runs all their infrastructure inside a private datacenter. Their ThingsBoard Gateway needs to connect to OPC-UA and MQTT sources inside the network but cannot access the internet due to strict firewall rules.
Prerequisites
The Offline Build requires the same prerequisites as the standard package installation, and also it’s important to have installed Python 3.11. If a Python version is incompatible, the installation gracefully exits with instructions for installing the correct Python version.
For installing a right Python version, you can use the following commands:
1
2
3
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get update
sudo apt-get install -y python3.11 python3.11-venv
Installation
Step 1. Download the deb file
Download installation package.
1
wget https://github.com/thingsboard/thingsboard-gateway/releases/latest/download/python3.11-thingsboard-gateway-offline.deb
Step 2. Install the gateway using apt
Install ThingsBoard IoT Gateway as package and run it as daemon uses the following command:
1
sudo apt install ./python3.11-thingsboard-gateway-offline.deb -y
Step 3. Check gateway status
1
systemctl status thingsboard-gateway
Troubleshooting
-
Wrong Python version
The installer will show a detailed guide for installing the required version.
-
Need to remove installed ThingsBoard IoT Gateway after fixing Python
When the required Python version is installed, remove the previously installed Gateway package using:
1
sudo dpkg --purge python3-thingsboard-gateway
Then, you can install the Offline Build package as described above.