PostgreSQL 15 install : Ubuntu
by Mark Nielsen
Copyright June 2022
Just basic install and Python.
- Links
- Install
- https://www.linuxtechi.com/how-to-install-postgresql-on-ubuntu/#google_vignette
- https://www.postgresql.org/download/linux/ubuntu/
- https://www.prisma.io/dataguide/postgresql/authentication-and-authorization/configuring-user-authentication#:~:text=To%20authenticate%20network%20connections%20from,or%20scram%2Dsha%2D256%20.
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-15
sudo systemctl status postgresql
echo "select version() " | sudo -iu postgres psql
echo "CREATE USER mark WITH PASSWORD 'mark';" | sudo -iu postgres psql
echo " ALTER USER postgres PASSWORD 'mark'" | sudo -iu postgres psql
echo " create database mark;" | sudo -iu postgres psql
echo " ALTER DATABASE mark OWNER TO mark" | sudo -iu postgres psql
# This will fail.
export PGPASSWORD=mark
psql -U mark
# This will work
psql -U mark -h 127.0.0.1 -c "create table test1 (i int);"
echo "select * from pg_settings where name in ('port'); " | sudo -iu postgres psql