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

How to compile and install postgreSQL 11.4 in CentOS 7.4 environment

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to compile and install postgreSQL 11.4 in CentOS 7.4 environment". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Install dependency packages

Yum install-y readline readline-devel openssl openssl-devel zlib zlib-devel

two。 Download software

Wget https://ftp.postgresql.org/pub/source/v11.4/postgresql-11.4.tar.gz

3. Extract and install

Tar-zvvf postgresql-11.4.tar.gz# enters the decompressed folder cd postgresql-11.4./configure-- prefix=/usr/local/pgsql # specifies the default installation path make # compiling make install # installation

4. Add users and change permissions

Useradd postgres # add user passwd postgres # set password mkdir-p / data/pgsql/datamkdir-p / data/pgsql/logcd / data/pgsql/logtouch pgsql.logchown-R postgres:postgres / data/pgsql

5. Add environment variabl

Vim / etc/profile

The contents are as follows:

# postgresqlexport PGHOME=/data/pgsqlexport PGBASE=/usr/local/pgsqlexport PATH=$PATH:$PGBASE/bin

Make it effective.

Source / etc/profile

6. Initialization data

Switch to su-postgres under postgres user

[postgres@localhost ~] $cd / usr/local/pgsql/bin/ [postgres@localhost bin] $lsclusterdb ecpg pg_config pg_isready pg_rewind pg_waldump vacuumdbcreatedb initdb pg_controldata pg_receivewal pg_test_fsync postgrescreateuser pg_archivecleanup pg_ctl pg_recvlogical pg_test_timing postmasterdropdb pg_basebackup pg_dump pg_resetwal Pg_upgrade psqldropuser pgbench pg_dumpall pg_restore pg_verify_checksums reindexdb [postgres@localhost bin] $. / initdb-D / data/pgsql/dataThe files belonging to this database system will be owned by user "postgres" .This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8" includes default database encoding has accordingly been set to "UTF8" default text search configuration will be set to "english". Data page checksums are disabled.fixing permissions on existing directory / data/pgsql/data... Okcreating subdirectories... Okselecting default max_connections... 100selecting default shared_buffers... 128MBselecting default timezone... PRCselecting dynamic shared memory implementation... Posixcreating configuration files... Okrunning bootstrap script... Okperforming post-bootstrap initialization... Oksyncing data to disk... OkWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option-A, or--auth-local and-- auth-host, the next time you run initdb.Success. You can now start the database server using:. / pg_ctl-D / data/pgsql/data-l logfile start

7. Check the data catalog:

[root@localhost data] # lsbase pg_hba.conf pg_notify pg_stat pg_twophase postgresql.auto.confglobal pg_ident.conf pg_replslot pg_stat_tmp PG_VERSION postgresql.confpg_commit_ts pg_logical pg_serial pg_subtrans pg_walpg_dynshmem pg_multixact pg_snapshots pg_tblspc pg_xact

Among them

The base directory is a tablespace directory

The global directory is a directory of related global variables

Pg_hba.conf is an access control profile

Postgresql.conf is the main configuration file for postgresql.

8. Modify the pg_hba.conf file

Change the connection of IPV4 in this file to 0.0.0.0 id 0, indicating that clients from all id connections are trusted, and the encryption method is changed to md5, as shown in the following figure:

9. Modify postgresql.conf configuration file

Change localhost to * to monitor all network connections. Other parameters can be kept by default.

10. Turn off the firewall

Systemctl stop firewalld

11. Start the database

[postgres@localhost bin] $. / pg_ctl-D / data/pgsql/data-l/data / pgsql/log/pgsql.log startwaiting for server to start.... Doneserver started

twelve。 Log in to the database and set the password

[postgres@localhost bin] $. / psql psql Type "help" for help.postgres=#\ passwordEnter new password: Enter it again: postgres=#\ l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges-+- -+-postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | = c/postgres + | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | = c/postgres + | postgres=CTc/postgres (3 rows) |

13. Navicat login

This is the end of the content of "how to compile and install postgreSQL 11.4 in CentOS 7.4 environment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for 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

Database

Wechat

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

12
Report