Install PostgreSQL12 under CentOS7

PostgreSQL is a powerful open source database system. After more than 15 years of active development and continuous improvement, PostgreSQL has gained a high reputation in the industry for reliability, stability, and data consistency. PostgreSQL is a fully transaction-safe database that fully supports foreign keys, unions, views, triggers, and stored procedures (and supports the development of stored procedures in multiple languages). It supports most of the SQL:2008 standard data types, including integer, numeric, boolean, byte, character, date, time interval, and time. It also supports storing large binary objects , Including pictures, sounds and videos. PostgreSQL has native programming interfaces for many high-level development languages. As an enterprise-level database, PostgreSQL is proud of its various advanced functions, such as multi-version concurrency control (MVCC), point-in-time recovery (PITR), table Space, asynchronous replication, nested transactions, online hot standby, planning and optimization of complex queries, and pre-written logs for fault tolerance. It supports international character sets, multi-byte encodings, and supports operations such as sorting, case handling, and formatting in local languages. It is also fully scalable in the amount of data that can be managed and the concurrent access time of a large number of users allowed


The following describes the installation of PostgreSQL12 under CentOS7

This article refers to the installation instructions on the official website for installation

https://www.postgresql.org/download/linux/redhat/

1、 Configure PostgreSQL YUM source

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

2、 yum install postgresql12-server installation

The client will be automatically installed when the server is installed

yum install postgresql12

3、 Modify data file storage location

mkdir -p /data/pgsql12/data/

vi /usr/lib/systemd/system/postgresql-12.service

For example, modify as follows

Location of database directory

Environment=PGDATA=/data/pgsql12/data/

If you initialize the database at this time /usr/pgsql-12/bin/postgresql-12-setup initdb will prompt an error

4、 Initialize the database after modifying the directory permissions

chown -R postgres.postgres /data/pgsql12/data

chmod 755 /data/pgsql12/data/

rm -rf /data/pgsql12/data/*

Then initialize the database operation

/usr/pgsql-12/bin/postgresql-12-setup initdb

5、 Set the service to start automatically after booting, and start the postgresql-12 service

systemctl enable postgresql-12

systemctl start postgresql-12

6、 Test create a database

7、 Use the client to connect to the database, and test the creation and insertion of table data

8、 Set up remote database access

1 )vi /data/pgsql12/data/postgresql.conf

Change #listen_addresses ='localhost' to

listen_addresses = '*'

2 ) Modify vi /data/pgsql12/data/pg_hba.conf

Add the following line

host all all 192.168.31.0/24 trust

3 )su - postgres

psql -c "alter user postgres with password 'postgres@2019'"

systemctl restart postgresql-12.service

  1. Next, log in with the Navicat tool

Recommended Posts

Install PostgreSQL12 under CentOS7
CentOS install PostgreSQL 9.1
Centos 7 install PostgreSQL
Install mysql5.7 under CentOS7
Install CentOS under VMware
CentOS (linux) install PostgreSQL
Install mysql under Centos 7
Install Jenkins under Centos 7
Install MariaDB under MariaDB Centos7
Install mysql5.1 under CentOS6.5
Install Oracle11gR2 database under CentOS6.9
Install MySQL under Linux (CentOS 7)
Install Java JDK8 under CentOS6
1.5 Install Centos7
Install MongoDB database under CentOS7
CentOS 6.8 under linux install mongodb
Install Mesos tutorial under CentOS7
Install and configure keepalived under CentOS 5.9
Compile and install LAMP under Centos 5.2
[Introduction to redis] Install redis under Centos
Install Harbor mirror warehouse under CentOS
Install Python3 and ansible under CentOS8
Install the latest OpenCV4.3 under Centos8
Install and use docker under CentOS 6.8
How to install Postgresql on CentOS 8
Install Python3 and Py under CentOS7
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS7 install Docker
Centos6.5 install Tomcat
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
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
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
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk