How to install PostgreSQL - Ubuntu 24
PHP Developer, Laravel Lover ❤️, Entrepreneur, Founder @ Bee Delivery
📌 1. Install PostgreSQL
Update packages and install PostgreSQL server:
sudo apt update && sudo apt upgrade -y
Install PostgreSQL server
sudo apt install postgresql postgresql-contrib -y
Check if the service is active:
sudo systemctl status postgresql
📌 2. Create a new database and change user password
Switch to the administrative postgres user:
sudo -i -u postgres
Open the PostgreSQL prompt:
psql
Now execute the SQL commands:
-- Create database
CREATE DATABASE n8n_db;
-- Change postgres user password
ALTER USER postgres PASSWORD 'your_new_password';
-- Grant permissions to the user on the database
GRANT ALL PRIVILEGES ON DATABASE n8n_db TO postgres;