Update edge install instructions
- updated install instructions
This commit is contained in:
		
							parent
							
								
									d6fb28ebd7
								
							
						
					
					
						commit
						6f9e36d386
					
				@ -4,15 +4,15 @@ Here is the list of commands, that can be used to quickly install ThingsBoard Ed
 | 
			
		||||
Before continue to installation execute the following commands in order to install necessary tools:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo yum install -y nano wget
 | 
			
		||||
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 | 
			
		||||
sudo yum install -y nano wget && sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Install Java 17 (OpenJDK)
 | 
			
		||||
#### Step 1. Install Java 17 (OpenJDK)
 | 
			
		||||
ThingsBoard service is running on Java 17. Follow these instructions to install OpenJDK 17:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo yum install java-17-openjdk
 | 
			
		||||
sudo dnf install java-17-openjdk
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -39,112 +39,92 @@ OpenJDK Runtime Environment (...)
 | 
			
		||||
OpenJDK 64-Bit Server VM (build ...)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Configure PostgreSQL
 | 
			
		||||
#### Step 2. Configure ThingsBoard Database
 | 
			
		||||
ThingsBoard Edge supports SQL and hybrid database approaches.
 | 
			
		||||
 | 
			
		||||
### PostgresSql
 | 
			
		||||
ThingsBoard Edge uses PostgreSQL database as a local storage.
 | 
			
		||||
Instructions listed below will help you to install PostgreSQL.
 | 
			
		||||
To install PostgreSQL, follow the instructions below.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Update your system
 | 
			
		||||
sudo yum update
 | 
			
		||||
sudo dnf update
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**For CentOS 7:**
 | 
			
		||||
Install the repository RPM:
 | 
			
		||||
**For CentOS/RHEL 8:**
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Install the repository RPM (for CentOS 7):
 | 
			
		||||
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
 | 
			
		||||
# Install packages
 | 
			
		||||
sudo yum -y install epel-release yum-utils
 | 
			
		||||
sudo yum-config-manager --enable pgdg16
 | 
			
		||||
sudo yum install postgresql16-server postgresql16 postgresql16-contrib
 | 
			
		||||
# Initialize your PostgreSQL DB
 | 
			
		||||
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
 | 
			
		||||
sudo systemctl start postgresql-16
 | 
			
		||||
# Optional: Configure PostgreSQL to start on boot
 | 
			
		||||
# Install the repository RPM (For CentOS/RHEL 8):
 | 
			
		||||
sudo sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**For CentOS/RHEL 9:**
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Install the repository RPM (for CentOS 9):
 | 
			
		||||
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Install packages and initialize PostgreSQL. The PostgreSQL service will automatically start every time the system boots up.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo dnf -qy module disable postgresql && \
 | 
			
		||||
sudo dnf -y install postgresql16 postgresql16-server postgresql16-contrib && \
 | 
			
		||||
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb && \
 | 
			
		||||
sudo systemctl enable --now postgresql-16
 | 
			
		||||
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**For CentOS 8:**
 | 
			
		||||
Once PostgreSQL is installed, it is recommended to set the password for the PostgreSQL main user.
 | 
			
		||||
 | 
			
		||||
The following command will switch the current user to the PostgreSQL user and set the password directly in PostgreSQL.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Install the repository RPM (for CentOS 8):
 | 
			
		||||
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
 | 
			
		||||
# Install packages
 | 
			
		||||
sudo dnf -qy module disable postgresql
 | 
			
		||||
sudo dnf -y install postgresql16 postgresql16-server postgresql16-contrib
 | 
			
		||||
# Initialize your PostgreSQL DB
 | 
			
		||||
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
 | 
			
		||||
sudo systemctl start postgresql-16
 | 
			
		||||
# Optional: Configure PostgreSQL to start on boot
 | 
			
		||||
sudo systemctl enable --now postgresql-16
 | 
			
		||||
 | 
			
		||||
sudo -u postgres psql -c "\password"
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Once PostgreSQL is installed you may want to create a new user or set the password for the main user.
 | 
			
		||||
The instructions below will help to set the password for main PostgreSQL user:
 | 
			
		||||
Then, enter and confirm the password.
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
sudo su - postgres
 | 
			
		||||
psql
 | 
			
		||||
\password
 | 
			
		||||
\q
 | 
			
		||||
```
 | 
			
		||||
Since ThingsBoard Edge uses the PostgreSQL database for local storage, configuring MD5 authentication ensures that only authenticated users or 
 | 
			
		||||
applications can access the database, thus protecting your data. After configuring the password, 
 | 
			
		||||
edit the pg_hba.conf file to use MD5 hashing for authentication instead of the default method (ident) for local IPv4 connections.
 | 
			
		||||
 | 
			
		||||
Then, press "Ctrl+D" to return to main user console.
 | 
			
		||||
 | 
			
		||||
After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user.
 | 
			
		||||
 | 
			
		||||
Edit pg_hba.conf file:
 | 
			
		||||
To replace ident with md5, run the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo nano /var/lib/pgsql/16/data/pg_hba.conf
 | 
			
		||||
sudo sed -i 's/^host\s\+all\s\+all\s\+127\.0\.0\.1\/32\s\+ident/host    all             all             127.0.0.1\/32            md5/' /var/lib/pgsql/16/data/pg_hba.conf
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Locate the following lines:
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
# IPv4 local connections:
 | 
			
		||||
host    all             all             127.0.0.1/32            ident
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Replace `ident` with `md5`:
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
host    all             all             127.0.0.1/32            md5
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Finally, you should restart the PostgreSQL service to initialize the new configuration:
 | 
			
		||||
Then run the command that will restart the PostgreSQL service to apply configuration changes, connect to the database as a postgres user, 
 | 
			
		||||
and create the ThingsBoard Edge database (tb_edge). To connect to the PostgreSQL database, enter the PostgreSQL password.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo systemctl restart postgresql-16.service
 | 
			
		||||
sudo systemctl restart postgresql-16.service && psql -U postgres -d postgres -h 127.0.0.1 -W -c "CREATE DATABASE tb_edge;"
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Connect to the database to create ThingsBoard Edge DB:
 | 
			
		||||
#### Step 3. Choose Queue Service
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
psql -U postgres -d postgres -h 127.0.0.1 -W
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
ThingsBoard Edge is able to use different messaging systems/brokers for storing the messages and communication between ThingsBoard services. 
 | 
			
		||||
How to choose the right queue implementation?
 | 
			
		||||
 | 
			
		||||
Execute create database statement:
 | 
			
		||||
In Memory queue implementation is built-in and default. It is useful for development(PoC) environments and is not suitable for production deployments or any sort of cluster deployments.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
CREATE DATABASE tb_edge;
 | 
			
		||||
\q
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
Kafka is recommended for production deployments. This queue is used on the most of ThingsBoard production environments now.
 | 
			
		||||
 | 
			
		||||
#### ThingsBoard Edge service installation
 | 
			
		||||
In Memory queue is built in and enabled by default. No additional configuration is required.
 | 
			
		||||
 | 
			
		||||
#### Step 4. ThingsBoard Edge Service Installation
 | 
			
		||||
Download installation package:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
wget https://github.com/thingsboard/thingsboard-edge/releases/download/v${TB_EDGE_TAG}/tb-edge-${TB_EDGE_TAG}.rpm
 | 
			
		||||
wget wget https://github.com/thingsboard/thingsboard-edge/releases/download/v${TB_EDGE_TAG}/tb-edge-${TB_EDGE_TAG}.rpm
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -155,7 +135,7 @@ sudo rpm -Uvh tb-edge-${TB_EDGE_TAG}.rpm
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Configure ThingsBoard Edge
 | 
			
		||||
#### Step 5. Configure ThingsBoard Edge
 | 
			
		||||
To configure ThingsBoard Edge, you  can use the following command to automatically update the configuration file with specific values:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@ -169,25 +149,21 @@ EOL'
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
##### [Optional] Database Configuration
 | 
			
		||||
In case you changed default PostgreSQL datasource settings (**postgres**/**postgres**) please update the configuration file (**/etc/tb-edge/conf/tb-edge.conf**) with your actual values:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo nano /etc/tb-edge/conf/tb-edge.conf
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Please update the following lines in your configuration file. Make sure **to replace**:
 | 
			
		||||
- Replace 'postgres' with your actual PostgreSQL username;
 | 
			
		||||
- Replace 'PUT_YOUR_POSTGRESQL_PASSWORD_HERE' with your actual PostgreSQL password.
 | 
			
		||||
##### Configure PostgreSQL (Optional)
 | 
			
		||||
If you changed PostgreSQL default datasource settings, use the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf
 | 
			
		||||
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge
 | 
			
		||||
export SPRING_DATASOURCE_USERNAME=postgres
 | 
			
		||||
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
 | 
			
		||||
export SPRING_DATASOURCE_PASSWORD=<PUT_YOUR_POSTGRESQL_PASSWORD_HERE>
 | 
			
		||||
EOL'
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
PUT_YOUR_POSTGRESQL_PASSWORD_HERE: Replace with your actual PostgreSQL user password.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### [Optional] Update bind ports
 | 
			
		||||
If ThingsBoard Edge is going to be running on the same machine where ThingsBoard server (cloud) is running, you'll need to update configuration parameters to avoid port collision between ThingsBoard server and ThingsBoard Edge.
 | 
			
		||||
 | 
			
		||||
@ -206,7 +182,7 @@ EOL'
 | 
			
		||||
 | 
			
		||||
Make sure that ports above (18080, 11883, 15683) are not used by any other application.
 | 
			
		||||
 | 
			
		||||
#### Run installation script
 | 
			
		||||
#### Step 6. Run installation Script
 | 
			
		||||
Once ThingsBoard Edge is installed and configured please execute the following install script:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@ -214,18 +190,18 @@ sudo /usr/share/tb-edge/bin/install/install.sh
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Restart ThingsBoard Edge service
 | 
			
		||||
#### Step 7. Restart ThingsBoard Edge Service
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo service tb-edge restart
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Open ThingsBoard Edge UI
 | 
			
		||||
#### Step 8. Open ThingsBoard Edge UI
 | 
			
		||||
 | 
			
		||||
Once started, you will be able to open **ThingsBoard Edge UI** using the following link http://localhost:8080.
 | 
			
		||||
 | 
			
		||||
###### NOTE: Edge HTTP bind port update
 | 
			
		||||
 | 
			
		||||
Use next **ThingsBoard Edge UI** link **http://localhost:18080** if you updated HTTP 8080 bind port to **18080**.
 | 
			
		||||
If the Edge HTTP bind port was changed to 18080 during Edge installation, access the ThingsBoard Edge instance at http://localhost:18080.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,9 +4,26 @@ Here is the list of commands, that can be used to quickly install ThingsBoard Ed
 | 
			
		||||
 | 
			
		||||
Install <a href="https://docs.docker.com/engine/install/" target="_blank"> Docker CE</a> and <a href="https://docs.docker.com/compose/install/" target="_blank"> Docker Compose</a>.
 | 
			
		||||
 | 
			
		||||
#### Running ThingsBoard Edge as docker service
 | 
			
		||||
#### Step 1. Running ThingsBoard Edge
 | 
			
		||||
 | 
			
		||||
Create docker compose file for ThingsBoard Edge service:
 | 
			
		||||
Here you can find ThingsBoard Edge docker image:
 | 
			
		||||
 | 
			
		||||
<a href="https://hub.docker.com/r/thingsboard/tb-edge" target="_blank"> thingsboard/tb-edge</a>
 | 
			
		||||
 | 
			
		||||
#### Step 2. Choose Queue and/or Database Services
 | 
			
		||||
 | 
			
		||||
ThingsBoard Edge is able to use different messaging systems/brokers for storing the messages and communication between ThingsBoard services. 
 | 
			
		||||
How to choose the right queue implementation?
 | 
			
		||||
 | 
			
		||||
In Memory queue implementation is built-in and default. It is useful for development(PoC) environments and is not suitable for production deployments or any sort of cluster deployments.
 | 
			
		||||
 | 
			
		||||
Kafka is recommended for production deployments. This queue is used on the most of ThingsBoard production environments now.
 | 
			
		||||
 | 
			
		||||
Hybrid implementation combines PostgreSQL and Cassandra databases with Kafka queue service. It is recommended if you plan to manage 1M+ devices in production or handle high data ingestion rate (more than 5000 msg/sec).
 | 
			
		||||
 | 
			
		||||
Create a docker compose file for the ThingsBoard Edge service:
 | 
			
		||||
 | 
			
		||||
##### In Memory
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nano docker-compose.yml
 | 
			
		||||
@ -20,25 +37,22 @@ version: '3.8'
 | 
			
		||||
services:
 | 
			
		||||
  mytbedge:
 | 
			
		||||
    restart: always
 | 
			
		||||
    image: "thingsboard/tb-edge:${TB_EDGE_VERSION}"
 | 
			
		||||
    image: "thingsboard/tb-edge:3.9.1EDGE"
 | 
			
		||||
    ports:
 | 
			
		||||
      - "8080:8080"
 | 
			
		||||
      - "1883:1883"
 | 
			
		||||
      - "5683-5688:5683-5688/udp"
 | 
			
		||||
    environment:
 | 
			
		||||
      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tb-edge
 | 
			
		||||
      CLOUD_ROUTING_KEY: ${CLOUD_ROUTING_KEY}
 | 
			
		||||
      CLOUD_ROUTING_SECRET: ${CLOUD_ROUTING_SECRET}
 | 
			
		||||
      CLOUD_RPC_HOST: ${BASE_URL}
 | 
			
		||||
      CLOUD_RPC_PORT: ${CLOUD_RPC_PORT}
 | 
			
		||||
      CLOUD_RPC_SSL_ENABLED: ${CLOUD_RPC_SSL_ENABLED}
 | 
			
		||||
      CLOUD_ROUTING_KEY: PUT_YOUR_EDGE_KEY_HERE # e.g. 19ea7ee8-5e6d-e642-4f32-05440a529015
 | 
			
		||||
      CLOUD_ROUTING_SECRET: PUT_YOUR_EDGE_SECRET_HERE # e.g. bztvkvfqsye7omv9uxlp
 | 
			
		||||
      CLOUD_RPC_HOST: PUT_YOUR_CLOUD_IP # e.g. 192.168.1.1 or demo.thingsboard.io
 | 
			
		||||
    volumes:
 | 
			
		||||
      - tb-edge-data:/data
 | 
			
		||||
      - tb-edge-logs:/var/log/tb-edge
 | 
			
		||||
    ${EXTRA_HOSTS}
 | 
			
		||||
  postgres:
 | 
			
		||||
    restart: always
 | 
			
		||||
    image: "postgres:16"
 | 
			
		||||
    image: "postgres:15"
 | 
			
		||||
    ports:
 | 
			
		||||
      - "5432"
 | 
			
		||||
    environment:
 | 
			
		||||
@ -58,24 +72,20 @@ volumes:
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
##### [Optional] Update bind ports 
 | 
			
		||||
If ThingsBoard Edge is going to be running on the same machine where ThingsBoard server (cloud) is running, you'll need to update docker compose port mapping to avoid port collision between ThingsBoard server and ThingsBoard Edge.
 | 
			
		||||
If ThingsBoard Edge is set to run on the same machine where the ThingsBoard server is operating, you need to update port configuration to prevent port collision between the ThingsBoard server and ThingsBoard Edge.
 | 
			
		||||
 | 
			
		||||
Please update next lines of `docker-compose.yml` file:
 | 
			
		||||
Ensure that the ports 18080, 11883, 15683-15688 are not used by any other application.
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
ports:
 | 
			
		||||
  - "18080:8080"
 | 
			
		||||
  - "11883:1883"
 | 
			
		||||
  - "15683-15688:5683-5688/udp"
 | 
			
		||||
Then, update the port configuration in the docker-compose.yml file:
 | 
			
		||||
```bash
 | 
			
		||||
sed -i ‘s/8080:8080/18080:8080/; s/1883:1883/11883:1883/; s/5683-5688:5683-5688\/udp/15683-15688:5683-5688\/udp/’ docker-compose.yml
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
Make sure that ports above (18080, 11883, 15683-15688) are not used by any other application.
 | 
			
		||||
 | 
			
		||||
#### Start ThingsBoard Edge
 | 
			
		||||
Set the terminal in the directory which contains the `docker-compose.yml` file and execute the following commands to up this docker compose directly:
 | 
			
		||||
Set the terminal in the directory which contains the docker-compose.yml file and execute the following commands to up this docker compose directly:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
docker compose up -d
 | 
			
		||||
docker compose logs -f mytbedge
 | 
			
		||||
docker compose up -d && docker compose logs -f mytbedge
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -90,11 +100,12 @@ docker-compose up -d
 | 
			
		||||
docker-compose logs -f mytbedge
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Open ThingsBoard Edge UI
 | 
			
		||||
#### Step 3. Open ThingsBoard Edge UI
 | 
			
		||||
 | 
			
		||||
Once started, you will be able to open **ThingsBoard Edge UI** using the following link http://localhost:8080.
 | 
			
		||||
Once the Edge service is started, open the Edge UI at http://localhost:8080.
 | 
			
		||||
 | 
			
		||||
###### NOTE: Edge HTTP bind port update 
 | 
			
		||||
 | 
			
		||||
Use next **ThingsBoard Edge UI** link **http://localhost:18080** if you updated HTTP 8080 bind port to **18080**.
 | 
			
		||||
If the Edge HTTP bind port was changed to 18080 during Edge installation, access the ThingsBoard Edge instance at http://localhost:18080.
 | 
			
		||||
 | 
			
		||||
Please use your tenant credentials from local Server instance or ThingsBoard Live Demo to log in to the ThingsBoard Edge.
 | 
			
		||||
 | 
			
		||||
@ -1,51 +1,48 @@
 | 
			
		||||
Here is the list of commands, that can be used to quickly install ThingsBoard Edge on Ubuntu Server and connect to the server.
 | 
			
		||||
 | 
			
		||||
#### Install Java 17 (OpenJDK)
 | 
			
		||||
ThingsBoard service is running on Java 17. Follow these instructions to install OpenJDK 17:
 | 
			
		||||
#### Step 1. Install Java 17 (OpenJDK)
 | 
			
		||||
ThingsBoard service is running on Java 17. To install OpenJDK 17, follow these instructions:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo apt update
 | 
			
		||||
sudo apt install openjdk-17-jdk
 | 
			
		||||
sudo apt update && sudo apt install openjdk-17-jdk
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Please don't forget to configure your operating system to use OpenJDK 17 by default.
 | 
			
		||||
You can configure which version is the default using the following command:
 | 
			
		||||
Configure your operating system to use OpenJDK 17 by default. You can configure the default version by running the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo update-alternatives --config java
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You can check the installation using the following command:
 | 
			
		||||
To check the installed Java version on your system, use the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
java -version
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Expected command output is:
 | 
			
		||||
The expected result is:
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
openjdk version "17.x.xx"
 | 
			
		||||
openjdk version "17.x.xx" 
 | 
			
		||||
OpenJDK Runtime Environment (...)
 | 
			
		||||
OpenJDK 64-Bit Server VM (build ...)
 | 
			
		||||
OpenJDK 64-Bit Server VM (...)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Configure PostgreSQL
 | 
			
		||||
#### Step 2. Configure ThingsBoard Edge Database
 | 
			
		||||
 | 
			
		||||
ThingsBoard Edge supports SQL and hybrid database approaches. See the architecture page for details.
 | 
			
		||||
 | 
			
		||||
### Configure PostgreSQL
 | 
			
		||||
ThingsBoard Edge uses PostgreSQL database as a local storage.
 | 
			
		||||
Instructions listed below will help you to install PostgreSQL.
 | 
			
		||||
 | 
			
		||||
To install the PostgreSQL database, run these commands:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# install **wget** if not already installed:
 | 
			
		||||
sudo apt install -y wget
 | 
			
		||||
 | 
			
		||||
# import the repository signing key:
 | 
			
		||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
 | 
			
		||||
 | 
			
		||||
# add repository contents to your system:
 | 
			
		||||
RELEASE=$(lsb_release -cs)
 | 
			
		||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list
 | 
			
		||||
# Automated repository configuration:
 | 
			
		||||
sudo apt install -y postgresql-common
 | 
			
		||||
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
 | 
			
		||||
 | 
			
		||||
# install and launch the postgresql service:
 | 
			
		||||
sudo apt update
 | 
			
		||||
@ -54,25 +51,35 @@ sudo service postgresql start
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Once PostgreSQL is installed you may want to create a new user or set the password for the main user.
 | 
			
		||||
The instructions below will help to set the password for main PostgreSQL user:
 | 
			
		||||
Once PostgreSQL is installed, it is recommended to set the password for the PostgreSQL main user.
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
sudo su - postgres
 | 
			
		||||
psql
 | 
			
		||||
\password
 | 
			
		||||
\q
 | 
			
		||||
The following command will switch the current user to the PostgreSQL user and set the password directly in PostgreSQL.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo -u postgres psql -c "\password"
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then, press “Ctrl+D” to return to main user console and connect to the database to create ThingsBoard Edge DB:
 | 
			
		||||
Then, enter and confirm the password.
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
psql -U postgres -d postgres -h 127.0.0.1 -W
 | 
			
		||||
CREATE DATABASE tb_edge;
 | 
			
		||||
\q
 | 
			
		||||
Finally, create a new PostgreSQL database named tb_edge by running the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
echo "CREATE DATABASE tb_edge;" | psql -U postgres -d postgres -h 127.0.0.1 -W
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Thingsboard Edge service installation
 | 
			
		||||
#### Step 3. Choose Queue Service
 | 
			
		||||
 | 
			
		||||
ThingsBoard Edge can use different messaging systems and brokers for storing messages and enabling communication between its services. Choose the appropriate queue implementation based on your specific business needs:
 | 
			
		||||
 | 
			
		||||
In Memory: The built-in and default queue implementation. It is useful for development or proof-of-concept (PoC) environments, but is not recommended for production or any type of clustered deployments due to limited scalability.
 | 
			
		||||
 | 
			
		||||
Kafka: Recommended for production deployments. This queue is used in the most of ThingsBoard production environments now.
 | 
			
		||||
 | 
			
		||||
In Memory queue is built in and enabled by default. No additional configuration is required.
 | 
			
		||||
 | 
			
		||||
#### Step 4. ThingsBoard Edge Service Installation
 | 
			
		||||
Download installation package:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@ -87,39 +94,34 @@ sudo dpkg -i tb-edge-${TB_EDGE_TAG}.deb
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Configure ThingsBoard Edge
 | 
			
		||||
#### Step 5. Configure ThingsBoard Edge
 | 
			
		||||
To configure ThingsBoard Edge, you  can use the following command to automatically update the configuration file with specific values:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf
 | 
			
		||||
export CLOUD_ROUTING_KEY=${CLOUD_ROUTING_KEY}
 | 
			
		||||
export CLOUD_ROUTING_SECRET=${CLOUD_ROUTING_SECRET}
 | 
			
		||||
export CLOUD_RPC_HOST=${BASE_URL}
 | 
			
		||||
export CLOUD_RPC_PORT=${CLOUD_RPC_PORT}
 | 
			
		||||
export CLOUD_RPC_SSL_ENABLED=${CLOUD_RPC_SSL_ENABLED}
 | 
			
		||||
export CLOUD_ROUTING_KEY=<PUT_YOUR_EDGE_KEY_HERE>
 | 
			
		||||
export CLOUD_ROUTING_SECRET=<PUT_YOUR_EDGE_SECRET_HERE>
 | 
			
		||||
export CLOUD_RPC_HOST=demo.thingsboard.io
 | 
			
		||||
export CLOUD_RPC_PORT=7070
 | 
			
		||||
export CLOUD_RPC_SSL_ENABLED=false
 | 
			
		||||
EOL'
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
##### [Optional] Database Configuration
 | 
			
		||||
In case you changed default PostgreSQL datasource settings (**postgres**/**postgres**) please update the configuration file (**/etc/tb-edge/conf/tb-edge.conf**) with your actual values:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo nano /etc/tb-edge/conf/tb-edge.conf
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Please update the following lines in your configuration file. Make sure **to replace**:
 | 
			
		||||
- Replace 'postgres' with your actual PostgreSQL username;
 | 
			
		||||
- Replace 'PUT_YOUR_POSTGRESQL_PASSWORD_HERE' with your actual PostgreSQL password.
 | 
			
		||||
##### [Optional] Configure PostgreSQL
 | 
			
		||||
If you changed PostgreSQL default datasource settings, use the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf
 | 
			
		||||
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge
 | 
			
		||||
export SPRING_DATASOURCE_USERNAME=postgres
 | 
			
		||||
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
 | 
			
		||||
export SPRING_DATASOURCE_PASSWORD=<PUT_YOUR_POSTGRESQL_PASSWORD_HERE>
 | 
			
		||||
EOL'
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
PUT_YOUR_POSTGRESQL_PASSWORD_HERE: Replace with your actual PostgreSQL user password.
 | 
			
		||||
 | 
			
		||||
##### [Optional] Update bind ports
 | 
			
		||||
If ThingsBoard Edge is going to be running on the same machine where ThingsBoard server (cloud) is running, you'll need to update configuration parameters to avoid port collision between ThingsBoard server and ThingsBoard Edge.
 | 
			
		||||
 | 
			
		||||
@ -138,7 +140,7 @@ EOL'
 | 
			
		||||
 | 
			
		||||
Make sure that ports above (18080, 11883, 15683) are not used by any other application.
 | 
			
		||||
 | 
			
		||||
#### Run installation script
 | 
			
		||||
#### Step 6. Run installation Script
 | 
			
		||||
 | 
			
		||||
Once ThingsBoard Edge is installed and configured please execute the following install script:
 | 
			
		||||
 | 
			
		||||
@ -147,14 +149,14 @@ sudo /usr/share/tb-edge/bin/install/install.sh
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Restart ThingsBoard Edge service
 | 
			
		||||
#### Step 7. Restart ThingsBoard Edge Service
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo service tb-edge restart
 | 
			
		||||
{:copy-code}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Open ThingsBoard Edge UI
 | 
			
		||||
#### Step 8. Open ThingsBoard Edge UI
 | 
			
		||||
 | 
			
		||||
Once started, you will be able to open **ThingsBoard Edge UI** using the following link http://localhost:8080.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user