Installing postgresql
Fedora, RHEL, CentOS, or similar OS
# yum install postgresql
# yum install postgresql-server
Initialize postgresql Files
# postgresql-setup initdb
Setup postgresql
Set address
127.0.0.1
and::1
totrust
at thepg_hba.conf
file. The directory might not be visible to non-sudoers. Runsudo su
first.- In Fedora, RHEL, CentOS, or similar OS, the file location is
/var/lib/pgsql/data/pg_hba.conf
- In Fedora, RHEL, CentOS, or similar OS, the file location is
Login to psql shell:
$ psql --host=localhost --user=postgres
Set password inside psql shell:
\password
Logout of psql shell with
\q
or press Ctrl+D on your keyboard.Restart postgres service:
# service postgresql restart
Login to psql shell again with the password you set.
$ psql --host=localhost --user=postgres
This action should prompt you with password.
Enable first the postgres service:
# systemctl enable postgresql.service