§2024-05-19

機器: h2jammy.yushei.net, Ubuntu 22.04

  1. clean up old installation of postgresql
alexlai@h2Jammy:~$ systemctl status postgresql.service 
● postgresql.service - PostgreSQL database server
     Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-05-19 04:53:17 CST; 4h 22min ago
       Docs: man:postgres(1)
   Main PID: 827 (postgres)
      Tasks: 6 (limit: 9222)
     Memory: 22.3M
        CPU: 657ms
     CGroup: /system.slice/postgresql.service
             ├─827 /usr/local/pgsql/bin/postgres -D /var/lib/postgres/data -p 5432
...
$ sudo systemctl stop postgresql
$ sudo rm -rf /usr/local/pgsql /var/lib/postgres
$ sudo rm  /etc/systemd/system/postgresql.service 
$ sudo rm -rf /usr/local/pgsql /var/lib/postgres
  1. Install
$ sudo apt update
$ sudo apt install postgresql postgresql-contrib