This article only talks about the installation of PostgreSQL under CentOS 7.x. For other systems, please check: https://www.postgresql.org/download
The version of PostgreSQL used is: PostgreSQL 10
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
yum install postgresql10
yum install postgresql10-server
rpm -aq| grep postgres
The output is as follows:
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
su -postgres switch user, the prompt will change to'-bash-4.2$'
psql -U postgres logs in to the database, and the prompt becomes'postgres=#'
ALTER USER postgres WITH PASSWORD 'postgres'Set the postgres user password to postgres
\ q Exit the database
vim /var/lib/pgsql/10/data/postgresql.conf
modify#listen_addresses ='localhost'For listen_addresses='*'
Of course, here'*'You can also change to any server IP you want to open
vi m/var/lib/pgsql/10/data/pg_hba.conf
Modify the following content to trust the specified server connection
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.157.1/32 (IP of the server to be connected) trust
systemctl restart postgresql-10
Navicat is used here
connection succeeded:
Recommended Posts