Installing postgres on Ubuntu

I have installed Ubuntu 18.10 and needed to figure out how to install a postgres database server. Below are the steps. First we install the server components, then we check that the server is running using psql, and finally we change the default password for postgres to ‘securePassword’.

# Update package repo and install
sudo apt update
sudo apt install postgresql postgresql-contrib

# Check that database is running and that you can connect:
sudo -i -u postgres

# Exit and secure password of postgres user:
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'securePpassword';"

Leave a Reply

Your email address will not be published. Required fields are marked *