- The installation of PostgreSQL 16 on Ubuntu using the apt package manager involves several key steps: updating package lists, resolving dependencies, downloading packages, unpacking and installing, setting up the Postgres service, and cleaning up.
- The command `sudo apt update` fetches the latest package lists from configured repositories.
- The command `sudo apt install postgresql-16` triggers apt to search for the package and resolve dependencies.
- Necessary .deb package files are downloaded to the `/var/cache/apt/archives/` directory.
- Each downloaded .deb package is extracted, files are placed in appropriate locations, pre-installation and post-installation scripts are run, and the dpkg package database is updated.
- Post-installation scripts create a dedicated postgres Linux user and group, initialize the data directory, generate default configuration files, set up system catalog tables, configure PostgreSQL to start automatically on boot, and start the PostgreSQL server.
- The PostgreSQL server is configured to start automatically on system boot using `systemctl enable postgresql.service`.
- The PostgreSQL server is started with `systemctl start postgresql.service`.
- After installation, several processes are actively running: postmaster, checkpointer, background writer, walwriter, autovacuum launcher, stats collector, and logical replication launcher.
- PostgreSQL is ready to accept client connections through the local socket and will start automatically on future system reboots.