Choice log no. 1778480994 – PostgreSQL 18 Administration Inistallation

Ubutntu 24.04
PostgreSQL 18

sudo apt update && sudo apt upgrade -y
sudo apt dist-upgrade
sudo apt autoremove
sudo reboot

sudo apt install -y postgresql-common
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
libcommon-sense-perl libjson-perl libjson-xs-perl libtypes-serialiser-perl postgresql-client-common
The following NEW packages will be installed:
libcommon-sense-perl libjson-perl libjson-xs-perl libtypes-serialiser-perl postgresql-client-common postgresql-common
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 395 kB of archives.
After this operation, 1,326 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu noble/main amd64 libjson-perl all 4.10000-1 [81.9 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 postgresql-client-common all 257build1.1 [36.4 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 postgresql-common all 257build1.1 [161 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu noble/main amd64 libcommon-sense-perl amd64 3.75-3build3 [20.4 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu noble/main amd64 libtypes-serialiser-perl all 1.01-1 [11.6 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 libjson-xs-perl amd64 4.040-0ubuntu0.24.04.1 [83.7 kB]
Fetched 395 kB in 1s (706 kB/s)
Preconfiguring packages …
Selecting previously unselected package libjson-perl.
(Reading database … 147196 files and directories currently installed.)
Preparing to unpack …/0-libjson-perl_4.10000-1_all.deb …
Unpacking libjson-perl (4.10000-1) …
Selecting previously unselected package postgresql-client-common.
Preparing to unpack …/1-postgresql-client-common_257build1.1_all.deb …
Unpacking postgresql-client-common (257build1.1) …
Selecting previously unselected package postgresql-common.
Preparing to unpack …/2-postgresql-common_257build1.1_all.deb …
Adding ‘diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common’
Unpacking postgresql-common (257build1.1) …
Selecting previously unselected package libcommon-sense-perl:amd64.
Preparing to unpack …/3-libcommon-sense-perl_3.75-3build3_amd64.deb …
Unpacking libcommon-sense-perl:amd64 (3.75-3build3) …
Selecting previously unselected package libtypes-serialiser-perl.
Preparing to unpack …/4-libtypes-serialiser-perl_1.01-1_all.deb …
Unpacking libtypes-serialiser-perl (1.01-1) …
Selecting previously unselected package libjson-xs-perl.
Preparing to unpack …/5-libjson-xs-perl_4.040-0ubuntu0.24.04.1_amd64.deb …
Unpacking libjson-xs-perl (4.040-0ubuntu0.24.04.1) …
Setting up postgresql-client-common (257build1.1) …
Setting up libcommon-sense-perl:amd64 (3.75-3build3) …
Setting up libtypes-serialiser-perl (1.01-1) …
Setting up libjson-perl (4.10000-1) …
Setting up libjson-xs-perl (4.040-0ubuntu0.24.04.1) …
Setting up postgresql-common (257build1.1) …

Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages…
Removing obsolete dictionary files:
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
Processing triggers for man-db (2.12.0-4build2) …
Scanning processes…
Scanning linux images…

Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be noble-pgdg.

Press Enter to continue, or Ctrl-C to abort.

Using keyring /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
Writing /etc/apt/sources.list.d/pgdg.sources …

Running apt-get update …
Get:1 https://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease [180 kB]
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu noble InRelease
Get:4 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 Packages [481 kB]
Hit:5 http://us.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu noble-backports InRelease
Fetched 661 kB in 1s (607 kB/s)
Reading package lists… Done

You can now start installing packages from apt.postgresql.org.

Have a look at https://wiki.postgresql.org/wiki/Apt for more information;
most notably the FAQ at https://wiki.postgresql.org/wiki/Apt/FAQ

sudo apt update
Hit:1 https://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu noble InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
2 packages can be upgraded. Run ‘apt list –upgradable’ to see them.

sudo apt install postgresql-18
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
libllvm19 libpq5 postgresql-18-jit postgresql-client-18 postgresql-client-common postgresql-common
Suggested packages:
libpq-oauth postgresql-doc-18
The following NEW packages will be installed:
libllvm19 libpq5 postgresql-18 postgresql-18-jit postgresql-client-18
The following packages will be upgraded:
postgresql-client-common postgresql-common
2 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 48.6 MB of archives.
After this operation, 202 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 postgresql-common all 290.pgdg24.04+1 [113 kB]
Get:2 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 postgresql-client-common all 290.pgdg24.04+1 [48.1 kB]
Get:3 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 libpq5 amd64 18.3-1.pgdg24.04+1 [255 kB]
Get:4 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 postgresql-client-18 amd64 18.3-1.pgdg24.04+1 [2,086 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 libllvm19 amd64 1:19.1.1-1ubuntu1~24.04.2 [28.7 MB]
Get:6 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 postgresql-18 amd64 18.3-1.pgdg24.04+1 [7,527 kB]
Get:7 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 postgresql-18-jit amd64 18.3-1.pgdg24.04+1 [9,867 kB]
Fetched 48.6 MB in 2s (31.9 MB/s)
Preconfiguring packages …
(Reading database … 147418 files and directories currently installed.)
Preparing to unpack …/0-postgresql-common_290.pgdg24.04+1_all.deb …
Leaving ‘diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common’
Unpacking postgresql-common (290.pgdg24.04+1) over (257build1.1) …
Preparing to unpack …/1-postgresql-client-common_290.pgdg24.04+1_all.deb …
Unpacking postgresql-client-common (290.pgdg24.04+1) over (257build1.1) …
Selecting previously unselected package libllvm19:amd64.
Preparing to unpack …/2-libllvm19_1%3a19.1.1-1ubuntu1~24.04.2_amd64.deb …
Unpacking libllvm19:amd64 (1:19.1.1-1ubuntu1~24.04.2) …
Selecting previously unselected package libpq5:amd64.
Preparing to unpack …/3-libpq5_18.3-1.pgdg24.04+1_amd64.deb …
Unpacking libpq5:amd64 (18.3-1.pgdg24.04+1) …
Selecting previously unselected package postgresql-client-18.
Preparing to unpack …/4-postgresql-client-18_18.3-1.pgdg24.04+1_amd64.deb …
Unpacking postgresql-client-18 (18.3-1.pgdg24.04+1) …
Selecting previously unselected package postgresql-18.
Preparing to unpack …/5-postgresql-18_18.3-1.pgdg24.04+1_amd64.deb …
Unpacking postgresql-18 (18.3-1.pgdg24.04+1) …
Selecting previously unselected package postgresql-18-jit.
Preparing to unpack …/6-postgresql-18-jit_18.3-1.pgdg24.04+1_amd64.deb …
Unpacking postgresql-18-jit (18.3-1.pgdg24.04+1) …
Setting up postgresql-client-common (290.pgdg24.04+1) …
Removing obsolete conffile /etc/postgresql-common/supported_versions …
Setting up libllvm19:amd64 (1:19.1.1-1ubuntu1~24.04.2) …
Setting up libpq5:amd64 (18.3-1.pgdg24.04+1) …
Setting up postgresql-common (290.pgdg24.04+1) …
Installing new version of config file /etc/postgresql-common/pg_upgradecluster.d/analyze …
Replacing config file /etc/postgresql-common/createcluster.conf with new version
Setting up postgresql-client-18 (18.3-1.pgdg24.04+1) …
update-alternatives: using /usr/share/postgresql/18/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-18 (18.3-1.pgdg24.04+1) …
Creating new PostgreSQL cluster 18/main …
/usr/lib/postgresql/18/bin/initdb -D /var/lib/postgresql/18/main –auth-local peer –auth-host scram-sha-256 –no-instructions
The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.

The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.

Data page checksums are enabled.

fixing permissions on existing directory /var/lib/postgresql/18/main … ok
creating subdirectories … ok
selecting dynamic shared memory implementation … posix
selecting default “max_connections” … 100
selecting default “shared_buffers” … 128MB
selecting default time zone … America/Los_Angeles
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … ok
syncing data to disk … ok
Setting up postgresql-18-jit (18.3-1.pgdg24.04+1) …
Processing triggers for libc-bin (2.39-0ubuntu8.7) …
Processing triggers for man-db (2.12.0-4build2) …
Scanning processes…
Scanning linux images…

Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

Sanity check
sudo systemctl status postgresql
● postgresql.service – PostgreSQL RDBMS
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: enabled)
Active: active (exited) since Sun 2026-05-10 13:29:30 PDT; 4min 17s ago
Main PID: 1833 (code=exited, status=0/SUCCESS)
CPU: 3ms

May 10 13:29:30 pvews systemd[1]: Starting postgresql.service – PostgreSQL RDBMS…
May 10 13:29:30 pvews systemd[1]: Finished postgresql.service – PostgreSQL RDBMS.

Confirm user
sudo -i -u postgres
postgres@pvews:~$ psql
psql (18.3 (Ubuntu 18.3-1.pgdg24.04+1))
Type “help” for help.