Install PostgreSQL 9.6
-
Install PostgreSQL 9.6 from the PGDG repository. CentOS 7 ships with PostgreSQL 9.2. The PGDG repository provides version 9.6.
sudo yum install postgresql96-{server,contrib}
- Initialise the database.
sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
- Set up authentication
- Allow MD5 authentication from localhost
sudo sed -ri 's/^(local.*)peer/\1md5/;s/^(host.*)ident/\1md5/' /var/lib/pgsql/9.6/data/pg_hba.conf
- Trust the ‘postgres’ user
sudo sed -i '/^local/ilocal\tall\t\tpostgres\t\t\t\ttrust' /var/lib/pgsql/9.6/data/pg_hba.conf
- Allow MD5 authentication from localhost
-
Enable and start the service.
sudo systemctl enable postgresql-9.6
sudo systemctl start postgresql-9.6