Centos 7 install PostgreSQL

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

  1. Install the repository
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
  1. Install the client
yum install postgresql10
  1. Install the server
yum install postgresql10-server
  1. Verify that the installation is successful
rpm -aq| grep postgres

The output is as follows:

  1. Initialize the database
/usr/pgsql-10/bin/postgresql-10-setup initdb
  1. Enable auto start
systemctl enable postgresql-10
systemctl start postgresql-10
  1. Configure firewall
firewall-cmd --permanent --add-port=5432/tcp  
firewall-cmd --permanent --add-port=80/tcp  
firewall-cmd --reload  
  1. Modify user password
 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
  1. Enable remote access
  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
  1. Trust remote connection
 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
  1. Restart service
systemctl restart postgresql-10
  1. Connect using DBMS software

Navicat is used here

connection succeeded:

Recommended Posts

CentOS install PostgreSQL 9.1
Centos 7 install PostgreSQL
Install PostgreSQL12 under CentOS7
CentOS (linux) install PostgreSQL
1.5 Install Centos7
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
How to install Postgresql on CentOS 8
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS 7 install Gitlab
CentOS7 install MySQL8
CentOS 7 install Java 1.8
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual
CentOS7 install Kubernetes 1.16.3
VirtualBox install centos7
centos7 install lamp
Install centos7 and connect
Install Docker on Centos7
Centos7 install docker-18.x original
install LNMP on centos7.4