sudo apt update
    sudo apt -y upgrade
    sudo apt install postgresql postgresql-client

    查看运行状态
    systemctl status postgresql.service

    允许远程访问:
    /etc/postgresql/12/main/pg_hba.conf
    添加一行:
    host all all 0.0.0.0/0 trust

    postgres.conf中
    listen_addresses = ‘*’

    修改密码
    psql
    alter role postgres with password ‘123’;