Install PostgreSQL and centos7postgresql on CentOS7
- Install the postgresql Software Package
sudo yum install postgresql-server postgresql
sudo su - postgresinitdb -D /var/lib/pgsql/data
systemctl status postgresql.servicesystemctl start postgresql.servicesystemctl stop postgresql.service
- Modify the configuration to allow remote access
Modify the/var/lib/pgsql/data/postgresql. conf file
listen_addresses ='*'
Modify the/var/lib/pgsql/data/pg_cmd.conf file **
host all all 0.0.0.0/0 trust
- After modification, restart the service.
systemctl restart postgresql.service
- Create users and databases
$ sudo su - postgres$ psql -U postgres -W$ Password for user postgres: postgrespostgres=# CREATE USER <user> WITH PASSWORD '<password>';postgres=# CREATE DATABASE test OWNER <user> ENCODING 'UTF8';
$ psql -U kongxx -d testtest=> \dt
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.