Installing and Configuring PostgreSQL for Mango
๐งฉ Installing and Configuring PostgreSQL for Mango
This guide provides detailed steps to install and configure PostgreSQL for use with Mango OS. You will install PostgreSQL, create a dedicated Mango database and user, and validate Mangoโs connection to ensure data is written properly.
๐ Overview
- Install and initialize PostgreSQL
- Secure the default
postgres role - Create a
mango database and user - Verify permissions and connectivity
- Point Mango to PostgreSQL via
mango.properties
๐ Part 1: PostgreSQL Installation
Switch to Superuser
sudo su
Install PostgreSQL Server and Tools
dnf install postgresql-server postgresql-contrib
Initialize the Database
postgresql-setup --initdb
Enable and Start PostgreSQL Service
systemctl enable postgresql
systemctl start postgresql
Verify Installation
psql --version
๐ Part 2: Secure PostgreSQL and Set Password
Switch to the PostgreSQL User
su - postgres
Open the PostgreSQL Shell
psql
Set the Password for the postgres Role
\password postgres;
Choose a strong password and store it securely (e.g., Keeper). Exit when finished:
\q
๐งฑ Part 3: Create Database and User for Mango
Log in as postgres
su - postgres
psql
Create Mango Database and Role
CREATE DATABASE mango;
CREATE ROLE mango WITH LOGIN PASSWORD 'putthepasswordhere';
GRANT ALL PRIVILEGES ON DATABASE mango TO mango;
\q
Optional: Adjust pg_hba.conf for Local Access
Edit the file (path may vary by distro; on RHEL-family itโs typically /var/lib/pgsql/data/pg_hba.conf):
vi /var/lib/pgsql/data/pg_hba.conf
Ensure the following line allows local password authentication:
local all all md5
Reload PostgreSQL
systemctl restart postgresql
โ
Part 4: Verify Database Permissions
Test Login with Mango User
psql -U mango -d mango -W
Run Basic SQL Commands
CREATE TABLE test_table (test_id INT);
INSERT INTO test_table (test_id) VALUES (1);
SELECT * FROM test_table;
DROP TABLE test_table;
\q
If all commands succeed, the Mango user has proper privileges.
๐ Part 5: Connect Mango to PostgreSQL
Edit the mango.properties file and update the database connection settings:
db.type=postgres
db.url=jdbc:postgresql://localhost:5432/mango
db.username=mango
db.password=putthepasswordhere
Start Mango
systemctl start mango
Verify Mango is Writing to PostgreSQL
psql -U mango -d mango -W
SELECT * FROM events LIMIT 5;
โ
You should see at least one startup event listed.
๐งพ Summary
- Installed and initialized PostgreSQL
- Secured the default
postgres role - Created the
mango database and user - Connected Mango to PostgreSQL
- Verified data writes
๐ References
Related Articles
Mango v5 Minimum System Requirements
Overview Mango by Radix IoT is a browser-based, cross-platform application for monitoring, controlling, and analyzing data from sensors, PLCs, subsystems, databases, and web services. Performance depends on the number of data points, configuration, ...
Mango v5.4.x - Windows Installation
? Overview Installing Mango Automation on a Windows computer is straightforward. This guide walks you through: Setting up Java JDK 17 (Azul Zulu OpenJDK) Downloading and installing Mango Running Mango from the command line Configuring Mango as a ...
Installing Mango Automation via Docker on Ubuntu
? Overview This guide explains how to install and run Mango Automation as a Docker container on an Ubuntu host. It covers: Installing Docker Pulling and running the Mango image Editing mango.properties inside the container Viewing Mango log files ...
Configuring BACnet/IP data source and BACnet publisher in Mango
? Overview This guide outlines the steps to configure BACnet/IP communication in Mango OS, including setting up a BACnet Local Device, creating a BACnet/IP Data Source, and publishing points via a BACnet Publisher. These steps allow Mango to ...
Configuring Modbus IP Data Source in Mango
? Overview The Modbus IP data source in Mango OS is used to gather data from Modbus-compatible devices over an IP network. These devices can reside on a local network, an intranet, or even the public internet. The data source operates by polling the ...