- 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
- Debian/Ubuntu-based system
- sudo privileges
- Network access to download packages and keys
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
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
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
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.
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
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
The following screenshots were included in the uploaded ZIP and are packaged with this README for reference.
- 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
postgresaccount and use strong passwords.
- postgres.txt
- pgadmin.txt
- pgvector.txt
- updatepassword.txt
- Screenshots folder with images
Generated from provided files.













