#!/bin/bash set -e # Exit immediately if a command exits with a non-zero status # Export DEBIAN_FRONTEND to ensure non-interactive installations export DEBIAN_FRONTEND=noninteractive # Update package lists apt update -y # Upgrade existing packages apt-get -y -o Dpkg::Options::="--force-confnew" upgrade apt upgrade -y # Install essential packages apt-get --yes install jq curl wget sudo apt-transport-https gpg net-tools # Add 3CX repository key and sources wget -O- http://repo.3cx.com/key.pub | gpg --dearmor | tee /usr/share/keyrings/3cx-archive-keyring.gpg > /dev/null echo "deb [arch=amd64 by-hash=yes signed-by=/usr/share/keyrings/3cx-archive-keyring.gpg] http://repo.3cx.com/debian/2000 bookworm main" >> /etc/apt/sources.list echo "deb [arch=amd64 by-hash=yes signed-by=/usr/share/keyrings/3cx-archive-keyring.gpg] http://repo.3cx.com/debian-security/2000 bookworm-security main" >> /etc/apt/sources.list echo "deb [arch=amd64 by-hash=yes signed-by=/usr/share/keyrings/3cx-archive-keyring.gpg] http://repo.3cx.com/3cx bookworm main" > /etc/apt/sources.list.d/3cxpbx.list # Update package lists again to include 3CX repository apt update -y # Install PostgreSQL, Nginx, and 3CX PBX apt-get --yes install postgresql-15 postgresql-client-15 nginx # Preconfigure 3CX PBX installation if possible # (Note: Replace with actual debconf settings if required) # Example: # echo "3cxpbx 3cxpbx/some_option select some_value" | debconf-set-selections apt-get --yes install 3cxpbx # Notify user echo "" echo " - - - " echo "REMINDER TO CHANGE THE DEFAULT PASSWORD"