Setup database
1. Setup PostgreSQL (Ubuntu)
-
Download and install PostgreSQL.
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo service postgresql start -
Open the
psql
shell.sudo -u postgres psql
-
Create your database.
CREATE DATABASE 'your_database_name';
-
Create an admin account.
CREATE USER 'your_username' WITH ENCRYPTED PASSWORD 'your_password';
-
Grant admin privileges to the new account.
GRANT ALL PRIVILEGES ON DATABASE 'your_database_name' TO 'your_username';
ALTER USER 'your_username' CREATEDB;After these commands, type
\q
orexit
to leave thepsql
prompt. -
Verify the database was created by connecting to it as the
postgres
superuser.sudo -u postgres psql -d 'your_database_name'
tip
Keep <username>
, <password>
and <your_database_name>
for the next step.
Last updated on June 12, 2025 by Ayman.