How to Install PostgreSQL on FreeBSD

1. Update all available repository and upgrade all packages to the latest

pkg update
pkg upgrade

2. Install PostgreSQL 13

pkg install postgresql13-server postgresql13-client

3. Add the PostgreSQL to the system boot:

sysrc postgresql_enable=yes

4. Initialize the PostgreSQL database

/usr/local/etc/rc.d/postgresql initdb

5. Start the PostgreSQL service and check its status

service postgresql start
service postgresql status