Skip to content
Stand with Ukraine flag

Install from Source

Build and run ThingsBoard IoT Gateway directly from source on Ubuntu or Debian-based systems. This method is recommended for development and local customization.

  • Python 3.10 or higher is installed.
  • git is available on the system.
  1. Install system dependencies.

    Terminal window
    sudo apt install python3-dev python3-pip python3-venv libglib2.0-dev git
  2. Clone the repository.

    Terminal window
    git clone --recurse-submodules https://github.com/thingsboard/thingsboard-gateway.git --depth 1
  3. Enter the project directory.

    Terminal window
    cd thingsboard-gateway
  4. Create and activate a virtual environment.

    Terminal window
    python3 -m venv venv && source venv/bin/activate
  5. Install Python dependencies.

    Terminal window
    pip install -r requirements.txt
  6. Install the Gateway package.

    Terminal window
    python setup.py install
  7. Create the logs directory.

    Terminal window
    mkdir logs
  8. Configure the Gateway. Open the configuration file and set your ThingsBoard host and access token:

    Terminal window
    thingsboard-gateway/thingsboard_gateway/config/tb_gateway.json

    For a full description of all configuration options, see the configuration guide.

  9. Start the Gateway to verify the installation.

    Terminal window
    python3 ./thingsboard_gateway/tb_gateway.py
  1. Copy the Dockerfile to the project root.

    Terminal window
    cp docker/Dockerfile .
  2. Build the image.

    Terminal window
    docker build -t local-gateway .

When developing custom extensions, enable Hot Reloader to restart the Gateway automatically whenever a project file changes:

Terminal window
python3 ./thingsboard_gateway/tb_gateway.py true