Skip to content

Step-by-step guide for installing PostgreSQL, pgAdmin, pgvector, and managing backups/restores on Ubuntu/Debian.

License

Notifications You must be signed in to change notification settings

S0ME2/postgresql-setup-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

PostgreSQL & pgAdmin — Installation, Backup, and Restore (with pgvector & password update)

This README combines all provided instructions and screenshots.

Table of contents

  • Prerequisites
  • Install PostgreSQL (APT / Debian / Ubuntu)
  • Install pgAdmin
  • Install pgvector extension
  • Update postgres user password
  • Backup a PostgreSQL database
  • Restore a PostgreSQL database
  • Screenshots
  • Notes & troubleshooting

Prerequisites

  • Debian/Ubuntu-based system
  • sudo privileges
  • Network access to download packages and keys

Install PostgreSQL (APT / Debian / Ubuntu)

Steps (from uploaded content):

Commands found in postgres.txt:

sudo apt install curl ca-certificates

sudo install -d /usr/share/postgresql-common/pgdg

sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
. /etc/os-release

sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list"

sudo apt update

sudo apt install postgresql-18

Install pgAdmin

Commands found in pgadmin.txt:

curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

sudo apt install pgadmin4

Install pgvector extension

Commands found in pgvector.txt:

sudo apt update

sudo apt install postgresql-<your_version>-pgvector

sudo systemctl restart postgresql

After installing, restart PostgreSQL and create the extension in your database:

sudo systemctl restart postgresql
sudo -u postgres psql -d your_database
CREATE EXTENSION IF NOT EXISTS vector;
\q

Update postgres user password

Commands found in updatepassword.txt:

sudo -u postgres psql

alter user postgres with password 'password';

quit

Make sure to replace the example password with a secure one.

Backup a PostgreSQL database

Common commands (examples):

# Backup a single DB (custom format)
sudo -u postgres pg_dump -d mydb -F c -b -v -f /var/backups/mydb.backup

# Backup all DBs (text SQL)
sudo -u postgres pg_dumpall -f /var/backups/all_databases.sql

Restore a PostgreSQL database

Examples:

# Restore custom-format backup
sudo -u postgres createdb mydb
sudo -u postgres pg_restore -d mydb -v /var/backups/mydb.backup

# Restore SQL dump
sudo -u postgres psql -d mydb -f /var/backups/all_databases.sql

Screenshots

The following screenshots were included in the uploaded ZIP and are packaged with this README for reference.

Screenshot 1

001_shot.png

Screenshot 2

002_shot.png

Screenshot 3

003_shot.png

Screenshot 4

004_shot.png

Screenshot 5

005_shot.png

Screenshot 6

006_shot.png

Screenshot 7

007_shot.png

Screenshot 8

008_shot.png

Screenshot 9

009_shot.png

Screenshot 10

010_shot.png

Screenshot 11

011_shot.png

Screenshot 12

012_shot.png

Screenshot 13

013_shot.png

Screenshot 14

014_shot.png

Notes & troubleshooting

  • Replace placeholders like <your_version> with the PostgreSQL major version (e.g., 18).
  • If apt complains about keys, verify key download and paths.
  • Restart PostgreSQL after installing extensions: sudo systemctl restart postgresql.
  • Secure the postgres account and use strong passwords.

Source files included

  • postgres.txt
  • pgadmin.txt
  • pgvector.txt
  • updatepassword.txt
  • Screenshots folder with images

Generated from provided files.

About

Step-by-step guide for installing PostgreSQL, pgAdmin, pgvector, and managing backups/restores on Ubuntu/Debian.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published