In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the method of installing local RPM in PostgreSQL 10.12". In the daily operation, I believe that many people have doubts about the method of installing local RPM in PostgreSQL 10.12. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what is the method of installing local RPM in PostgreSQL 10.12?" Next, please follow the editor to study!
2. Local RPM installation
Local RPM package download address:
Https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7.7-x86_64/
Find the following two packages to download:
Postgresql10-10.12-1PGDG.rhel7.x86_64.rpm
Postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm
Create users and groups for managing PG:
[root@open_source ~] # groupadd postgres [root @ open_source ~] # useradd-g postgres postgres [root @ open_source ~] # passwd postgresChanging password for user postgres.New password: BAD PASSWORD: The password contains the user name in some formRetype new password: passwd: all authentication tokens updated successfully.
Install PostgreSQL 10.12 locally:
[root@open_source] # ls-rtltotal 6632 RWKui Rafaq-1 root root 6048 Feb 23 15:47 pgdg-redhat-repo-latest.noarch.rpm-rw-r--r-- 1 root root 1657936 Feb 23 16:14 postgresql10- 10.12-1PGDG.rhel7.x86 * 64.rpmMuhashi rwkashi-1 root root 4753176 Feb 23 16:14 postgresql10-server-10.12-1PGDG.rhel7.x86q64.rpmMuhrhr- 1 root root 365156 Feb 23 16:23 postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm [root@open_source ~] # rpm-ivh postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpmwarning: postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature Key ID 442df0f8: NOKEYPreparing... # # [100%] Updating / installing... 1:postgresql10-libs-10.12-1PGDG.rhe## [root@open_source] # rpm-ivh postgresql10- 10.12-1PGDG.rhel7.x86_64.rpmwarning: postgresql10- 10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEYPreparing... # # [100%] Updating / installing... 1:postgresql10-10.12-1PGDG.rhel7 # # [root@open_source] # rpm-ivh postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpmwarning: postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEYPreparing... # # [100%] Updating / installing... 1:postgresql10-server-10.12-1PGDG.r## check whether the installation is successful: [root@open_source ~] # rpm-qa | grep postgresql10postgresql10-10.12-1PGDG.rhel7.x86_64postgresql10-libs-10.12-1PGDG.rhel7.x86_64postgresql10-server-10.12-1PGDG.rhel7.x86_64
Initialize the database:
[root@open_source] # / usr/pgsql-10/bin/postgresql-10-setup initdbInitializing database... OK
Check the configuration:
[root@open_source ~] # cat / usr/lib/systemd/system/postgresql-10.service | egrep-v "^ $| ^ #" [Unit] Description=PostgreSQL 10 database serverDocumentation= https://www.postgresql.org/docs/10/static/After=syslog.targetAfter=network.target[Service]Type=notifyUser=postgresGroup=postgresEnvironment=PGDATA=/var/lib/pgsql/10/data/OOMScoreAdjust=-1000Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adjEnvironment=PG_OOM_ADJUST_VALUE=0ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA } ExecStart=/usr/pgsql-10/bin/postmaster-D ${PGDATA} ExecReload=/bin/kill-HUP $MAINPIDKillMode=mixedKillSignal=SIGINT TimeoutSec= 0 [install] WantedBy=multi-user.target
Start the database method 1:
[root@open_source ~] # systemctl start postgresql-10.service [root@open_source bin] # systemctl status postgresql-10* postgresql-10.service-PostgreSQL 10 database server Loaded: loaded (/ usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled) Active: active (running) since Sun 2020-02-23 17:07:19 EST 55min ago Docs: https://www.postgresql.org/docs/10/static/ Process: 12481 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited Status=0/SUCCESS) Main PID: 12486 (postmaster) CGroup: / system.slice/postgresql-10.service |-12486 / usr/pgsql-10/bin/postmaster-D / var/lib/pgsql/10/data/ |-12488 postgres: logger process |-12490 postgres: checkpointer process |-12491 postgres: writer process |-12492 postgres: wal writer process |-12493 postgres: autovacuum Launcher process |-12494 postgres: stats collector process `- 12495 postgres: bgworker: logical replication launcher Feb 23 17:07:19 open_source systemd [1]: Starting PostgreSQL 10 database server...Feb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 1715 07purl 19.702 EST [12486] LOG: listening on IPv6 address ":: 1" Port 5432Feb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 17 port 5432Feb 07 EST 19.702 EST [12486] LOG: listening on IPv4 address "127.0t 5432Feb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 17 EST 07V 19.703 EST [12486] LOG: listening on Unix socket" / var/ru....5432 "Feb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 17:07 : 19.704 EST [12486] LOG: listening on Unix socket "/ tmp/.s....5432" Feb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 1707Parade 19.710 EST [12486] LOG: redirecting log output to logging...rocessFeb 23 17:07:19 open_source postmaster [12486]: 2020-02-23 17plu 07Rod 19.710 EST [12486] HINT: Future log output will appear in... "log" .Feb 23 17: 07:19 open_source systemd [1]: Started PostgreSQL 10 database server.Hint: Some lines were ellipsized Use-l to show in full. [root@open_source ~] # ps-ef | grep-I postgres | grep-v greppostgres 12486 17:07? 00:00:00 / usr/pgsql-10/bin/postmaster-D / var/lib/pgsql/10/data/postgres 12488 12486 0 17:07? 00:00:00 postgres: logger process postgres 12490 12486 0 17:07? 00:00:00 postgres: checkpointer process postgres 12491 12486 0 17:07? 00:00: 00 postgres: writer process postgres 12492 12486 0 17:07? 00:00:00 postgres: wal writer process postgres 12493 12486 0 17:07? 00:00:00 postgres: autovacuum launcher process postgres 12494 12486 0 17:07? 00:00:00 postgres: stats collector process postgres 12495 12486 0 17:07? 00:00:00 postgres: bgworker: logical replication launcher
Start the database method 2:
[postgres@open_source ~] $cd / usr/pgsql-10/bin/ [Postgres @ open_source bin] $. / pg_ctl startwaiting for server to start....2020-02-23 18 usr/pgsql-10/bin/ 04usr/pgsql-10/bin/ 33.686 EST [12823] LOG: listening on IPv4 address "127.0.0.1" Port 54322020-02-23 18 listening on Unix socket 04LOG 33.687 EST [12823] LOG: listening on Unix socket "/ var/run/postgresql/.s.PGSQL.5432" 2020-02-23 18V 4V 33.688 EST [12823] LOG: listening on Unix socket "/ tmp/.s.PGSQL.5432" 2020-02-23 18V 0433.693 EST [12823] LOG: redirecting log output to logging collector process2020-02-23 18L 04v 33.693 EST [12823] HINT: Future log output will appear in directory "log". Doneserver started [Postgres @ open_source bin] $. / pg_ctl statuspg_ctl: server is running (PID: 12823) / usr/pgsql-10/bin/postgres [postgres@open_source bin] $ps-ef | grep postgre | grep-v greproot 12800 9637 0 18:04 pts/0 00:00:00 su-postgrespostgres 12801 12800 18:04 pts/0 00:00:00-bashpostgres 12823 10 18:04 pts/0 00:00:00 / usr/pgsql-10/bin/postgrespostgres 12824 12823 0 18:04? 00:00:00 postgres: logger process postgres 12826 12823 0 18:04? 00:00:00 postgres: checkpointer process postgres 12827 12823 0 18:04? 00:00:00 postgres: writer process postgres 12828 12823 0 18:04? 00:00:00 postgres: wal writer process postgres 12829 12823 0 18:04? 00:00:00 postgres: autovacuum launcher process postgres 12830 12823 0 18:04? 00: 00:00 postgres: stats collector process postgres 12831 12823 18:04? 00:00:00 postgres: bgworker: logical replication launcher postgres 12837 12801 0 18:05 pts/0 00:00:00 ps-ef
Configure user environment variables:
[postgres@open_source ~] $vi .bash _ profile export PGPORT=5432export PGHOST=open_sourceexport PGHOME=/usr/pgsql-10/export PGDATA=/home/postgres/dataexport.utf8export LD_LIBRARY_PATH=/usr/pgsql-10/libexport PATH=$PGHOME/bin:/usr/bin:/usr/sbin:/sbin:$PATHexport MANPATH=$PGHOME/share/man:$MANPATHexport PGUSER=postgresexport PGDATABASE=postgres
Create the database:
[postgres@open_source] $initdb-D $PGDATAThe 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.utf8" 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 / home/postgres/data... Okcreating subdirectories... Okselecting default max_connections... 100selecting default shared_buffers... 128MBselecting default timezone... America/New_Yorkselecting dynamic shared memory implementation... Posixcreating configuration files... Okrunning bootstrap script... Okperforming post-bootstrap initialization... Oksyncing data to disk... Ok WARNING: 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 / home/postgres/data-l logfile start
Log in to the database:
[postgres@open_source] $psqlpsql: could not connect to server: Connection refused Is the server running on host "open_source" (192.168.84.30) and accepting TCP/IP connections on port 5432? [postgres@open_source ~] $cd / var/lib/pgsql/10/ data [Postgres @ open_source data] $ls-rtltotal 56drwx-2 postgres postgres 6 Feb 23 16:51 pg_commit_ts-rw- 1 postgres postgres 3 Feb 23 16:51 PG_VERSIONdrwx- 2 postgres postgres 6 Feb 23 16:51 pg_twophasedrwx- 2 postgres postgres 6 Feb 23 16:51 pg_tblspcdrwx-- -2 postgres postgres 6 Feb 23 16:51 pg_snapshotsdrwx- 2 postgres postgres 6 Feb 23 16:51 pg_serialdrwx- 2 postgres postgres 6 Feb 23 16:51 pg_replslotdrwx- 4 postgres postgres 36 Feb 23 16:51 pg_multixactdrwx- 2 postgres postgres 6 Feb 23 16:51 pg_dynshmem-rw- 1 postgres postgres 22992 Feb 23 16:51 postgresql.conf-rw -1 postgres postgres 88 Feb 23 16:51 postgresql.auto.conf-rw- 1 postgres postgres 1636 Feb 23 16:51 pg_ident.conf-rw- 1 postgres postgres 4269 Feb 23 16:51 pg_hba.confdrwx- 2 postgres postgres 18 Feb 23 16:51 pg_xactdrwx- 3 postgres postgres 60 Feb 23 16:51 pg_waldrwx- 2 postgres postgres 18 Feb 23 16 : 51 pg_subtransdrwx- 2 postgres postgres 4096 Feb 23 16:51 globaldrwx- 5 postgres postgres 41 Feb 23 16:51 base-rw- 1 postgres postgres 58 Feb 23 17:07 postmaster.optsdrwx- 2 postgres postgres 18 Feb 23 17:07 pg_notifydrwx- 2 postgres postgres 32 Feb 23 17:07 log-rw- 1 postgres postgres 30 Feb 23 17:07 current_logfilesdrwx-- -4 postgres postgres 68 Feb 23 18:03 pg_logicaldrwx- 2 postgres postgres 6 Feb 23 18:03 pg_stat_tmpdrwx- 2 postgres postgres 25 Feb 23 18:03 pg_stat [postgres@open_source data] $echo listen_addresses = "'*'" > postgresql.confs [Postgres @ open_source data] $echo "host all all 192.xxx.xxx.xxx/32 trust" > > pg_hba.conf [postgres@open_source data] $pg_ctl startwaiting for server to start....2020-02-23 1815 40 LOG 17.588 EST [13271] LOG: listening on IPv4 address "0.0.0.0" Port 54322020-02-23 1840 listening on IPv6 address 17.588 EST [13271] LOG: Port 54322020-02-23 18 var/run/postgresql/.s.PGSQL.5432 40 EST 17.589 EST [13271] LOG: listening on Unix socket "/ var/run/postgresql/.s.PGSQL.5432" 2020-02-23 18 40 LOG 17.589 EST [13271] LOG: listening on Unix socket "/ tmp/.s.PGSQL.5432" 2020-02-23 1840 40 EST [13271] LOG: redirecting log output to logging collector process2020-02-23 1840 17.595 EST [13271] HINT: Future log output will appear in directory "log". Doneserver start [Postgres @ open_source data] $psqlpsql (10.12) Type "help" for help. Postgres=# at this point, on the "PostgreSQL 10.12 local RPM installation method is what is the end of the study, I hope to be able to solve your doubts." The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.