欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

PostgreSQL10.12本地RPM安裝的方法是什么-創(chuàng)新互聯(lián)

這篇文章主要介紹“PostgreSQL 10.12本地RPM安裝的方法是什么”,在日常操作中,相信很多人在PostgreSQL 10.12本地RPM安裝的方法是什么問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”PostgreSQL 10.12本地RPM安裝的方法是什么”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!

創(chuàng)新互聯(lián)專注于企業(yè)成都營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)站重做改版、臺(tái)前網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計(jì)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為臺(tái)前等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

二、    本地RPM安裝

本地RPM包下載地址

https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7.7-x86_64/

找到如下兩個(gè)包下載即可:

postgresql10-10.12-1PGDG.rhel7.x86_64.rpm

postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm

創(chuàng)建用于管理PG的用戶和組:

[root@open_source ~]# groupadd postgres
[root@open_source ~]# useradd -g postgres postgres
[root@open_source ~]# passwd postgres
Changing password for user postgres.
New password: 
BAD PASSWORD: The password contains the user name in some form
Retype new password: 
passwd: all authentication tokens updated successfully.

本地安裝PostgreSQL 10.12:

[root@open_source ~]# ls -rtl
total 6632
-rw-r--r-- 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.rpm
-rw-r--r-- 1 root root 4753176 Feb 23 16:14 postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm
-rw-r--r-- 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.rpm
warning: postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql10-libs-10.12-1PGDG.rhe################################# [100%]
 
[root@open_source ~]# rpm -ivh postgresql10-10.12-1PGDG.rhel7.x86_64.rpm
warning: postgresql10-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql10-10.12-1PGDG.rhel7   ################################# [100%]
 
[root@open_source ~]# rpm -ivh postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm
warning: postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql10-server-10.12-1PGDG.r################################# [100%]
 
檢查安裝是否成功:
[root@open_source ~]# rpm -qa|grep postgresql10
postgresql10-10.12-1PGDG.rhel7.x86_64
postgresql10-libs-10.12-1PGDG.rhel7.x86_64
postgresql10-server-10.12-1PGDG.rhel7.x86_64

初始化數(shù)據(jù)庫:

[root@open_source ~]# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database ... OK

檢查配置:

[root@open_source ~]# cat /usr/lib/systemd/system/postgresql-10.service | egrep -v "^$|^#"
[Unit]
Description=PostgreSQL 10 database server
Documentation=/tupian/20230521/
After=syslog.target
After=network.target
[Service]
Type=notify
User=postgres
Group=postgres
Environment=PGDATA=/var/lib/pgsql/10/data/
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA}
ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
 
TimeoutSec=0
[Install]
WantedBy=multi-user.target

啟動(dòng)數(shù)據(jù)庫方法一:

[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: /tupian/20230521/
  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 17:07:19.702 EST [12486] LOG:  listening on IPv6 address "::1", port 5432
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.702 EST [12486] LOG:  listening on IPv4 address "127.0....t 5432
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07: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 17:07:19.710 EST [12486] LOG:  redirecting log output to logging...rocess
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07: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 grep
postgres  12486      1  0 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

啟動(dòng)數(shù)據(jù)庫方法二:

[postgres@open_source ~]$ cd /usr/pgsql-10/bin/
[postgres@open_source bin]$ ./pg_ctl start
waiting for server to start....2020-02-23 18:04:33.686 EST [12823] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2020-02-23 18:04:33.687 EST [12823] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-02-23 18:04:33.688 EST [12823] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-02-23 18:04:33.693 EST [12823] LOG:  redirecting log output to logging collector process
2020-02-23 18:04:33.693 EST [12823] HINT:  Future log output will appear in directory "log".
 done
server started
[postgres@open_source bin]$ ./pg_ctl status
pg_ctl: server is running (PID: 12823)
/usr/pgsql-10/bin/postgres
 
[postgres@open_source bin]$ ps -ef|grep postgre |grep -v grep
root      12800   9637  0 18:04 pts/0    00:00:00 su - postgres
postgres  12801  12800  0 18:04 pts/0    00:00:00 -bash
postgres  12823      1  0 18:04 pts/0    00:00:00 /usr/pgsql-10/bin/postgres
postgres  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  0 18:04 ?        00:00:00 postgres: bgworker: logical replication launcher  
postgres  12837  12801  0 18:05 pts/0    00:00:00 ps -ef

配置用戶環(huán)境變量:

[postgres@open_source ~]$ vi .bash_profile 
 
export PGPORT=5432
export PGHOST=open_source
export PGHOME=/usr/pgsql-10/
export PGDATA=/home/postgres/data
export.utf8
export LD_LIBRARY_PATH=/usr/pgsql-10/lib
export PATH=$PGHOME/bin:/usr/bin:/usr/sbin:/sbin:$PATH
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGDATABASE=postgres

創(chuàng)建數(shù)據(jù)庫:

[postgres@open_source ~]$ initdb -D $PGDATA
The 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".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
 
Data page checksums are disabled.
 
fixing permissions on existing directory /home/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... America/New_York
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
 
WARNING: enabling "trust" authentication for local connections
You 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

登錄數(shù)據(jù)庫:

[postgres@open_source ~]$ psql
psql: 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 -rtl
total 56
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_commit_ts
-rw------- 1 postgres postgres     3 Feb 23 16:51 PG_VERSION
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_twophase
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_tblspc
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_snapshots
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_serial
drwx------ 2 postgres postgres     6 Feb 23 16:51 pg_replslot
drwx------ 4 postgres postgres    36 Feb 23 16:51 pg_multixact
drwx------ 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.conf
drwx------ 2 postgres postgres    18 Feb 23 16:51 pg_xact
drwx------ 3 postgres postgres    60 Feb 23 16:51 pg_wal
drwx------ 2 postgres postgres    18 Feb 23 16:51 pg_subtrans
drwx------ 2 postgres postgres  4096 Feb 23 16:51 global
drwx------ 5 postgres postgres    41 Feb 23 16:51 base
-rw------- 1 postgres postgres    58 Feb 23 17:07 postmaster.opts
drwx------ 2 postgres postgres    18 Feb 23 17:07 pg_notify
drwx------ 2 postgres postgres    32 Feb 23 17:07 log
-rw------- 1 postgres postgres    30 Feb 23 17:07 current_logfiles
drwx------ 4 postgres postgres    68 Feb 23 18:03 pg_logical
drwx------ 2 postgres postgres     6 Feb 23 18:03 pg_stat_tmp
drwx------ 2 postgres postgres    25 Feb 23 18:03 pg_stat
 
[postgres@open_source data]$ echo listen_addresses = "'*'" >>  postgresql.conf
[postgres@open_source data]$ echo "host all all 192.xxx.xxx.xxx/32 trust" >> pg_hba.conf
 
[postgres@open_source data]$ pg_ctl start
waiting for server to start....2020-02-23 18:40:17.588 EST [13271] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2020-02-23 18:40:17.588 EST [13271] LOG:  listening on IPv6 address "::", port 5432
2020-02-23 18:40:17.589 EST [13271] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-02-23 18:40:17.589 EST [13271] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-02-23 18:40:17.595 EST [13271] LOG:  redirecting log output to logging collector process
2020-02-23 18:40:17.595 EST [13271] HINT:  Future log output will appear in directory "log".
 done
server started
[postgres@open_source data]$ psql
psql (10.12)
Type "help" for help.
 
postgres=#

到此,關(guān)于“PostgreSQL 10.12本地RPM安裝的方法是什么”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

網(wǎng)站欄目:PostgreSQL10.12本地RPM安裝的方法是什么-創(chuàng)新互聯(lián)
本文URL:http://www.chinadenli.net/article0/doceoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站App設(shè)計(jì)自適應(yīng)網(wǎng)站網(wǎng)站維護(hù)關(guān)鍵詞優(yōu)化用戶體驗(yàn)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)