Installing PostgreSQL 12:
sudo dnf install @postgresql:12
Then, contrib package for additional features: sudo dnf install postgresql-contrib
Afterwards, when I try to initialize the PostgreSQL database:
sudo postgresql-setup initdb
I'm getting: sudo: postgresql-setup: command not found
Also, when I try to check the status:
sudo systemctl status postgresql
Getting this error: Unit postgresql.service could not be found.
What I'm doing wrong? If this way of installing is wrong, is there another option to install postgresql on centos?
You have only installed the PostgreSQL client application on your server. In order to install the server software, you need to install the postgresql-server
package which will satisfy those package dependencies. Afterwards you can follow this documentation to continue provisioning, configuring, and maintaining your new database.
https://www.postgresql.org/download/linux/redhat/
This gist of which, as you originally mentioned, is simply:
postgresql-setup initdb
systemctl enable postgresql.service --now
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.