Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing PostgreSQL12 in CentOS7

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Go to the official website to download the required version of https://www.postgresql.org/download/linux/redhat/

2. Start the installation

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

Yum install postgresql12-y

Yum install postgresql12-server-y

3. Database initialization and setup self-startup

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

Systemctl enable postgresql-12

Systemctl start postgresql-12

This step initializes the database command to create a folder named 12 in the / var/lib/pgsql directory, and 12 is the database version. If there is already a corresponding version of the folder here, an error will be reported in the initialization step. You need to delete the corresponding folder and initialize it.

4. A linux login user named postgres will be created by default, and the password will be changed here.

5. Modify the configuration file

Modify postgresql.conf: # listen_addresses = 'localhost' is listen_addresses =' *'

5.2 modify pg_hba.conf

Before modification

After modification

And restart

Systemctl restart postgresql-12

6. Set the account secret of login database

Su postgres # cannot log in with root user, switch to normal user

Psql-U postgres

\ password # set user password

Select version (); # View version

7. Log in and test the database connection

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report