To install PostgreSQL on a Linux server, follow these steps:
First, ensure your package list is up-to-date:
sudo apt update
Install PostgreSQL using the package manager:
sudo apt install postgresql postgresql-contrib
Start the PostgreSQL service and enable it to start on boot:
sudo systemctl start postgresql
sudo systemctl enable postgresql
Check the status of the PostgreSQL service to ensure it is running:
sudo systemctl status postgresql
Switch to the PostgreSQL user and access the PostgreSQL prompt:
sudo -i -u postgres
psql