Install postgresql 11 on CentOs7

Just what to do, no discussion.

rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql11-server
/usr/pgsql-11/bin/postgresql-11-setup initdb
systemctl enable postgresql-11.service
systemctl start postgresql-11.service
su - postgres
psql postgres
CREATE USER another_user WITH PASSWORD 'pass'
\q
createdb dbname -O another_user
exit
sudo find /var -name "pg_hba.conf"
local   all             all                                     peer -> local   all             all                                     md5
# optionally for using with docker
host    all             all             127.0.0.1/32            peer -> host    all             all             127.0.0.1/32            md5
psql -U another_user dbname -W < ./schema.sql

Links:
https://tecadmin.net/install-postgresql-11-on-centos/
https://www.linode.com/docs/databases/postgresql/how-to-install-postgresql-relational-databases-on-centos-7/

LEAVE A COMMENT