1. gemfile:

add gem "pg"`

remove gem "sqlite"`

2. console:

Install Postgresql and create a user:

sudo apt install postgresql libpq-dev
sudo su postgres
createuser --interactive
ubuntu
y 
exit

To create another user with a password:

sudo su postgres
createuser --interactive --pwprompt
username
password
y
exit

Now you can install the gem and run migrations:

bundle
rails db:create db:migrate
rails s

That’s it 🥳 !


Relevant links