Check if Postgres is installed on your computer
psql --version
Otherwise, Install PostGres
- Launch the Postgres console as the Postgres user
sudo -u postgres -i psql
or, in macOS:
psql postgres
In the Postgres console, create a user and database for your application.
CREATE DATABASE app_db; CREATE USER app_db_user WITH ENCRYPTED PASSWORD 'password'; GRANT ALL PRIVILEGES ON DATABASE app_db TO app_db_user;
With Docker
docker run --name postgres -e POSTGRES_PASSWORD = mysecretpassword -p 5432: 5432 -d postgres
(host: localhost, username: Postgres)