Postgres 14 on Ubuntu 22.04 LTS
by R. S. Doiel, 2022-08-26
This is just a quick set of notes for working with Postgres 14 on an Ubuntu 22.04 LTS machine. The goal is to setup Postgres 14 and have it available for personal work under a user account (e.g. jane.doe).
Assumptions
- include
jane.doeis in the sudo group jane.doeis the one logged in and installing Postgres for machine wide usejane.doewill want to work with her own database by default
Steps
- Install Postgres
- Confirm installation
- Add
jane.doeuser providing access
Below is the commands I typed to run to complete the three steps.
sudo apt install postgresql postgresql-contrib
sudo -u createuser --interactive
jane.doe
y
What we've accomplished is installing Postgres, we've create a user in Postgres DB environment called "jane.doe" and given "jane.doe" superuser permissions, i.e. the permissions to manage Postgres databases.
At this point we have a jane.doe Postgres admin user. This means we can run the psql shell from the Jane Doe account to do any database manager tasks. To confirm I want to list the databases available
psql
SELECT datname FROM pg_database;
\quit
NOTE: This post is a distilation of what I learned from reading Digital Ocean's How To Install PostgreSQL on Ubuntu 22.04 [Quickstart], April 25, 2022 by Alex Garnett.