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

Explain the installation and configuration tutorial of PostgreSQL 11 under CentOS7 in detail

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Official website address

Installation reference steps are provided on the official website: click here to view the official website

two。 Install RPM

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

3. Install the client

Yum install postgresql11

4. Install the server side

Yum install postgresql11-server

5. Install dependency packages

Yum install postgresql11-libsyum install postgresql11-contribyum install postgresql11-devel

6. Database initialization and setup self-startup

/ usr/pgsql-11/bin/postgresql-11-setup initdbsystemctl enable postgresql-11systemctl start postgresql-11

This step initializes the database command in the / var/lib/pgsql directory to create the name 11 folder, 11 is the database version, if the installation is another version, corresponding to its version number (9.4,9.5); here, if there is a corresponding version of the folder, initialization this step will report an error, you need to delete the corresponding folder, and then initialize.

7. Modify database login password

After the database is initialized, a linux login user named postgres will be created by default. The password will be changed here.

[root@anleku ~] # passwd postgres

8. Log in to PostgreSQL

[root@anleku ~] # su-postgres-bash-4.2$ psqlpsql Type "help" for help.postgres=#

9. Create a user to access PostgreSQL

Postgres=# CREATE USER dbuser WITH PASSWORD'*'

10. Create a database and give users permissions

Postgres=# CREATE DATABASE exampledb OWNER dbuser;postgres=# GRANT ALL PRIVILEGES ON DATABASE exampledb TO dbuser

11. Exit psql

Postgres=#\ Q

twelve。 Modify the configuration file for remote computer access

[root@anleku ~] # vim / var/lib/pgsql/11/data/postgresql.conf

[root@anleku ~] # vim / var/lib/pgsql/11/data/pg_hba.conf

13. Restart the service

[root@anleku ~] # systemctl restart postgresql-11

Finally, remember to open the firewall port.

[root@anleku] # firewall-cmd-- query-port=5432/tcpno [root@anleku ~] # firewall-cmd-- add-port=5432/tcpsuccess [root@anleku ~] # firewall-cmd-- add-port=5432/tcp-- zone=public-- permanentsuccess

Summary

The above is the installation and configuration tutorial of PostgreSQL 11 under CentOS7 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

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