In this section, you install and configure PostgreSQL on an Azure Ubuntu 24.04 Pro Arm64 virtual machine running on Cobalt 100 processors.
At the end of this section, PostgreSQL is:
Update the operating system to ensure all packages are current.
sudo apt update && sudo apt upgrade -y
Install PostgreSQL and additional contributed modules.
sudo apt install -y postgresql postgresql-contrib
Confirm PostgreSQL is installed correctly.
psql --version
The output is similar to:
psql (PostgreSQL) 16.13 (Ubuntu 16.13-0ubuntu0.24.04.1)
Enable and start the PostgreSQL service.
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo systemctl status postgresql
The service should be active and running.
Switch to the PostgreSQL superuser and create a database and application user.
sudo -u postgres psql
CREATE USER appuser WITH PASSWORD 'StrongPassword123';
CREATE DATABASE appdb OWNER appuser;
GRANT ALL PRIVILEGES ON DATABASE appdb TO appuser;
Exit the PostgreSQL shell:
\q
Edit the PostgreSQL configuration file.
sudo nano /etc/postgresql/16/main/postgresql.conf
Search for listen_addresses and update it as follows:
Edit the host-based authentication file.
sudo nano /etc/postgresql/16/main/pg_hba.conf
Add the following line:
host all all 0.0.0.0/0 md5
Restart PostgreSQL to apply changes:
sudo systemctl restart postgresql
Tune PostgreSQL settings to better utilize Cobalt 100 resources.
sudo nano /etc/postgresql/16/main/postgresql.conf
Update or add the following parameters:
# Controls how much memory PostgreSQL uses for caching data pages.
# Set to 25-40% of total RAM. A 2GB shared buffer suits a VM with 8GB RAM.
shared_buffers = 2GB
# Memory allocated per sort or hash operation within a query.
# Higher values improve complex sort and hash join performance.
work_mem = 64MB
# Memory for maintenance operations such as VACUUM and CREATE INDEX.
# A larger value speeds up index builds and table maintenance.
maintenance_work_mem = 512MB
# Planner estimate of the total memory available for caching.
# Helps the planner choose index scans over sequential scans.
# Set to 75% of total RAM.
effective_cache_size = 6GB
# Maximum number of background parallel workers across all queries.
# Match this to the number of vCPUs on the Cobalt 100 instance.
max_parallel_workers = 8
# Maximum parallel workers a single query can use.
# Cobalt 100 dedicates one physical core per vCPU, so 4 workers
# lets queries use half the cores without contention.
max_parallel_workers_per_gather = 4
Restart PostgreSQL:
sudo systemctl restart postgresql
You’ve successfully installed and configured PostgreSQL on an Azure Ubuntu Arm64 virtual machine. Your setup includes:
Next, you’ll create database schemas, load data, and run transactional and analytical queries.