CentOS 7.5 1804 yum install Postgre
1. Preparatory work:
1.postgresql official website: https://www.postgresql.org
two。 Download page: https://www.postgresql.org/download/
3.Red Hat Family Linux (including CentOS/Fedora/Scientific/Oracle) download page: https://www.postgresql.org/download/linux/redhat/
4. The system used in this paper is: centos 7.51804
5. You can use the following URL to find the corresponding postgresql yum installation page:
Https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
Second, the system executes the command:
1.yum install-y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
Yum-y install postgresql11yum-y install postgresql11-server/usr/pgsql-11/bin/postgresql-11-setup initdbsystemctl enable postgresql-11systemctl start postgresql-11
3. Open the PostgreSQL port (this step can be ignored if the firewall is off) firewall-cmd-- zone=public-- add-port=5432/tcp-- permanentfirewall-cmd-- reloadfirewall-cmd-- list-ports
4. Set the password for postgres
Last login: Fri Jul 19 17:13:49 CST 2019 on pts/0
-bash-4.2$ psql-U postgres
Psql 11.4
Type "help" for help.
Postgres=# ALTER USER postgres with encrypted password 'welcome1'
ALTER ROLE
Postgres=#\ Q
-bash-4.2$ exit
Logout
Fifth, set up remote access
Command:
Vim / var/lib/pgsql/11/data/postgresql.conf
After opening it, you can find: listen_addresses is modified to:
Listen_addresses =''
The IP address to listen on; a comma-separated list of addresses; the default is' localhost'; for all'. Save and close after modification.
Command:
Vim / var/lib/pgsql/11/data/pg_hba.conf
After opening the text, the new content is as follows:
Host all all 0.0.0.0/0 md5
Save and close editing after the modification is complete.
six. Restart the postgres database
Systemctl restart postgresql-11