Skip to content
Stand with Ukraine flag

Install with Python (pip)

Install ThingsBoard IoT Gateway as a Python package using pip on Ubuntu or Debian-based systems.

  • Python 3.10 or higher is installed.
  • sudo access on the target machine.
  1. Install system libraries.

    Terminal window
    sudo apt install python3-dev python3-pip libglib2.0-dev
  2. Install the ThingsBoard Gateway package.

    Terminal window
    sudo pip3 install thingsboard-gateway
  3. Download and unpack the example configuration.

    Terminal window
    wget https://github.com/thingsboard/thingsboard-gateway/releases/latest/download/configs.tar.gz
    sudo mkdir /etc/thingsboard-gateway
    sudo mkdir /var/log/thingsboard-gateway
    sudo tar -xvzf configs.tar.gz -C /etc/thingsboard-gateway
  4. Set folder permissions. Replace YOUR_USER with the user that will run the Gateway.

    Terminal window
    sudo chown YOUR_USER:YOUR_USER -R /var/log/thingsboard-gateway
    sudo chown YOUR_USER:YOUR_USER -R /etc/thingsboard-gateway
    sudo chown YOUR_USER:YOUR_USER /tmp
  5. Create a Gateway device in ThingsBoard.

    Go to Entities > Gateways and click the + icon in the upper-right corner. Enter a name (e.g., My Gateway), select the default device profile, and click Create.

  6. Configure the Gateway credentials.

    Click the General configuration button on the Gateway device page and copy the Access token from the General tab. Then open the Gateway configuration file and paste the token, replacing the host and port with your ThingsBoard instance address:

    Terminal window
    nano /etc/thingsboard-gateway/config/tb_gateway.json
  7. Configure the log file path.

    Click General configuration again, navigate to the Logs tab, and set the File path to /var/log/thingsboard-gateway for each entry in the Local logging section. Click Save.

  8. Start the Gateway and verify.

    Terminal window
    thingsboard-gateway

    If everything is configured correctly, the Gateway device status changes to Active in ThingsBoard.