Prepare a separate PostgreSQL database server for Alphie, customize the connection details, and follow the platform-specific commands.
Compatibility note: The current Alphie Core installer is written for Rocky Linux 9, AlmaLinux 9, and RHEL 9. Debian/Ubuntu commands below are for setting up a separate PostgreSQL host, not for installing Alphie Core on those systems.
Provision a dedicated / seperate PostgreSQL server for Alphie before running your
install_alphie_core_system_python.sh, on your controller.
DB_SERVER_IP= → e.g., "1.1.1.1" (PostgreSQL server IP)CONTROLLER_IP= → e.g., "2.2.2.2" (Alphie controller IP)DB_PORT= → "5432" (Database Port 5432 is default)ALPHIE_DB= → "alphie"(Database Name)$ALPHIE_USER= → "ansible_admin" (Username to login to your DataBase With)ALPHIE_PASS= → "strong password" Fill Out below, to populate the lines with the correct information. Then copy and paste into the terminal, on you DataBase Server.
# Update & install
sudo dnf -y update
sudo dnf -y install postgresql-server postgresql-contrib
# Initialize database cluster (creates PGDATA at /var/lib/pgsql/data)
sudo /usr/bin/postgresql-setup --initdb
# Enable & start service
sudo systemctl enable --now postgresql
# Create role & database (interactive via psql)
sudo -iu postgres psql <<'SQL'
CREATE ROLE $ALPHIE_USER LOGIN PASSWORD '$ALPHIE_PASS' CREATEDB CREATEROLE;
CREATE DATABASE $ALPHIE_DB OWNER $ALPHIE_USER;
SQL
# Verify database exists & owner
sudo -iu postgres psql -c \
"SELECT datname, pg_catalog.pg_get_userbyid(datdba) AS owner FROM pg_database WHERE datname = 'ALPHIE_DB';"
# Allow the Alphie controller to connect (pg_hba.conf)
echo "host $ALPHIE_DB $ALPHIE_USER $CONTROLLER_IP/32 md5" \
| sudo tee -a /var/lib/pgsql/data/pg_hba.conf
# Listen only on the DB server IP and set port (postgresql.conf)
sudo sed -i -E "s|^[[:space:]]*#?[[:space:]]*listen_addresses[[:space:]]*=.*|listen_addresses = 'DB_SERVER_IP'|" /var/lib/pgsql/data/postgresql.conf
sudo sed -i -E "s|^[[:space:]]*#?[[:space:]]*port[[:space:]]*=.*|port = DB_PORT|" /var/lib/pgsql/data/postgresql.conf
sudo systemctl restart postgresql
sudo firewall-cmd --add-rich-rule="rule family=ipv4 source address=$CONTROLLER_IP/32 port port=$DB_PORT protocol=tcp accept" --permanent
sudo firewall-cmd --reload
# On the DB server
ss -lntp | grep $DB_PORT
# From the Alphie controller
PGPASSWORD='$ALPHIE_PASS' psql -h $DB_SERVER_IP -p $DB_PORT -U $ALPHIE_USER -d $ALPHIE_DB \
-c "select current_user, inet_client_addr();"
# Update & install
sudo apt-get update
sudo apt-get -y install postgresql postgresql-contrib
# Ensure service is enabled & running
sudo systemctl enable --now postgresql
# Create role & database (interactive via psql)
sudo -iu postgres psql <<'SQL'
CREATE ROLE $ALPHIE_USER LOGIN PASSWORD $ALPHIE_PASS CREATEDB CREATEROLE;
CREATE DATABASE $ALPHIE_DB OWNER $ALPHIE_USER;
SQL
# Verify database exists & owner
sudo -iu postgres psql -c \
"SELECT datname, pg_catalog.pg_get_userbyid(datdba) AS owner FROM pg_database WHERE datname = '$ALPHIE_DB';"
Debian/Ubuntu config lives under /etc/postgresql/<version>/main/. Adjust the
version path.
# Determine version directory (e.g., 15)
PGVER="$(psql -V | awk '{print $3}' | cut -d. -f1)"
CONF_DIR="/etc/postgresql/${PGVER}/main"
# Allow the Alphie controller to connect (pg_hba.conf)
echo "host $ALPHIE_DB $ALPHIE_USER $CONTROLLER_IP/32 md5" \
| sudo tee -a "${CONF_DIR}/pg_hba.conf"
# Listen only on the DB server IP and set port (postgresql.conf)
sudo sed -i -E "s|^[[:space:]]*#?[[:space:]]*listen_addresses[[:space:]]*=.*|listen_addresses = 'DB_SERVER_IP'|" /var/lib/pgsql/data/postgresql.conf
sudo sed -i -E "s|^[[:space:]]*#?[[:space:]]*port[[:space:]]*=.*|port = DB_PORT|" /var/lib/pgsql/data/postgresql.conf
sudo systemctl restart postgresql
# Allow only the Alphie controller IP to reach 5432/TCP
sudo ufw allow from $CONTROLLER_IP to any port $DB_PORT proto tcp
sudo ufw reload
# On the DB server
ss -lntp | grep $DB_PORT
# From the Alphie controller
PGPASSWORD='$ALPHIE_PASS' psql -h $DB_SERVER_IP -p $DB_PORT -U $ALPHIE_USER -d ALPHIE_DB \
-c "select current_user, inet_client_addr();"
Use the external database option when prompted by the current EL9 installer. The PostgreSQL server must be reachable and the target database must be empty.
On your Alphie controller host, point the installer to this database:
Keep your password secret. Combine host firewalls with network rules (security groups/VPC) for best results.
PostgreSQL location [local/external] (local): external
Core database name [alphie]: ALPHIE_DB
Core database user [ansible_admin]: ALPHIE_USER
PostgreSQL hostname/IP: DB_SERVER_IP
PostgreSQL port [5432]: DB_PORT
Password for PostgreSQL user ALPHIE_USER: [hidden]