Stage 5: Install and Configure ThingsBoard

Install ThingsBoard Locally

ThingsBoard can be installed locally or on a virtual machine (VM) in the cloud. The following section details a local deployment. The subsequent sections explain AWS and Azure VM deployments.

  1. Install Docker Desktop if it is not already installed.

  2. Open Docker.

    Warning

    If you are using Windows, and see a Hyper-V error, make sure Hyper-V is enabled, then reboot and relaunch Docker. If you still see an error, enable virtualization in the BIOS.

  3. If you are using Linux or macOS, open Terminal; if you are using Windows, open PowerShell (do not run as administrator).
  4. Enter the command:

    docker --version

    Verify that a Docker version number is displayed; this confirms that your installation was successful and Docker is ready to use.

  5. Create a working directory on your machine:

    mkdir thingsboard-docker

    cd thingsboard-docker
  1. Create a file, docker-compose.yml inside the new working directory and populate it with the following code:
version: '2.2'
services:
  mytb:
    restart: always
    image: thingsboard/tb-postgres
    ports:
      - 8081:9090
      - 1884:1883
      - 5683:5683/udp
    environment:
      TB_QUEUE_TYPE: in-memory
    volumes:
      - .mytb-data:/data
      - .mytb-logs:/var/log/thingsboard
 

Note

Port 1883 is already in use by ChirpStack; therefore, the MQTT port is mapped to port 1884 so that ThingsBoard and ChirpStack can run on the same machine.

  1. Create directories for the data and logs by running the following commands:

mkdir .mytb-data

mkdir .mytb-logs

  1. Start the server by running this command:

    docker-compose up

    Wait a few minutes while the container starts up.

    On Windows you may need to click Share it on the security popups you see.
  1. When the logging in the console stops, browse to http://127.0.0.1:8081/
  2. Sign in with the default login username tenant@thingsboard.org and password: tenant.

Since the ThingsBoard has been configured using Docker Compose, it is quite simple to deploy to a virtual machine on-prem, or to a cloud service of your choice. The following sections detail deployment on some popular cloud providers.

Note

If you would like to connect your ChirpStack instance to this instance of ThingsBoard instead of continuing to install on AWS or Azure, avoid opening up your network by making sure you have also installed ChirpStack on your local network, rather than on AWS or Azure. If ChirpStack is installed on a different machine from ThingsBoard, you will need to find the IP address of the machine and open port 8081.

On Linux, you can find your IP address by entering the hostname -I command into Terminal.

On macOS, you can find your IP address in System Preferences by choosing Network and viewing the IP address shown in the Status section.

On Windows, you can find your IP address by entering the ipconfig command into Command Prompt, and checking the listed IPv4 Address in the output.

We refer to this IP address later as THINGSBOARD_IP_ADDRESS.