一個伺服器安裝多個postgresql
下載postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64.rpm
postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm
postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm
postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
1、依次安裝
[root@localhost upload]# rpm -ivh postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-libs-9.4.4-1PGDG.rhe################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-9.4.4-1PGDG.rhel6 ################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-server-9.4.4-1PGDG.r################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
錯誤:依賴檢測失敗:
libxslt.so.1()(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.11)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.18)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.22)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
有依賴關係,用yum安裝
[root@localhost upload]# yum install libxslt
已載入外掛:fastestmirror
Could not retrieve mirrorlist error was
12: Timeout on : (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
base
| 3.6 kB 00:00:00
extras
| 3.4 kB 00:00:00
updates
| 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.163.com
* updates: mirrors.163.com
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 libxslt.x86_64.0.1.1.28-5.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
===============================================================================================================================================================================
==============================================================
Package 架構 版本
源 大小
===============================================================================================================================================================================
==============================================================
正在安裝:
libxslt x86_64 1.1.28-5.el7
base 242 k
事務概要
===============================================================================================================================================================================
==============================================================
安裝 1 軟體包
總下載量:242 k
安裝大小:486 k
Is this ok [y/d/N]: y
Downloading packages:
libxslt-1.1.28-5.el7.x86_64.rpm
| 242 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 資料庫已被非 yum 程式修改。
正在安裝 : libxslt-1.1.28-5.el7.x86_64
1/1
驗證中 : libxslt-1.1.28-5.el7.x86_64
1/1
已安裝:
libxslt.x86_64 0:1.1.28-5.el7
完畢!
[root@localhost upload]# rpm -ivh postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-contrib-9.4.4-1PGDG.################################# [100%]
2、初始化DB
[root@localhost upload]su - postgres
[postgres@localhost ~]$/usr/pgsql-9.4/bin/initdb -D /var/lib/pgsql/9.4/data (此處不建議放在根目錄下)
3、啟動DB
[postgres@localhost ~]$/usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data -l logfile start
進入postgresql
[postgres@localhost ~]psql
psql (9.4.4)
輸入 "help" 來獲取幫助資訊.
postgres=# \l
資料庫列表
名稱 | 擁有者 | 字元編碼 | 校對規則 | Ctype | 存取許可權
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行記錄)
安裝成功
4、建立第二個例項
[postgres@localhost ~]$/usr/pgsql-9.4/bin/initdb -D /var/lib/pgsql/9.4/data1
5、修改第二個例項的埠
[postgres@localhost ~]cd /var/lib/pgsql/9.4/data1
[postgres@localhost data1]$ls
base pg_clog pg_hba.conf pg_logical pg_notify pg_serial pg_stat pg_subtrans pg_twophase pg_xlog postgresql.conf
global pg_dynshmem pg_ident.conf pg_multixact pg_replslot pg_snapshots pg_stat_tmp pg_tblspc PG_VERSION postgresql.auto.conf
[postgres@localhost data1]$vi postgresql.conf
port = 8801
6、啟動第二個例項
[postgres@localhost data1]$/usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data1 -l logfile start 進入第二例項
[postgres@localhost data1]$psql -p 8801 --記得帶上埠號,不然預設5432埠
psql (9.4.4)
輸入 "help" 來獲取幫助資訊.
postgres=# \l
資料庫列表
名稱 | 擁有者 | 字元編碼 | 校對規則 | Ctype | 存取許可權
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行記錄)
7、檢視例項程式
[postgres@localhost 9.4]$netstat -anpt|grep postgre
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 15425/postgres
tcp 0 0 127.0.0.1:8801 0.0.0.0:* LISTEN 15435/postgres
tcp6 0 0 :::5432 :::* LISTEN 15425/postgres
tcp6 0 0 ::1:8801 :::* LISTEN 15435/postgres
[postgres@localhost 9.4]$ps -ef |grep /usr/pgsql-9.4/bin/postgres
postgres 15425 1 0 17:14 pts/5 00:00:00 /usr/pgsql-9.4/bin/postgres -D /var/lib/pgsql/9.4/data
postgres 15435 1 0 17:14 pts/5 00:00:00 /usr/pgsql-9.4/bin/postgres -D /var/lib/pgsql/9.4/data1
postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm
postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm
postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
1、依次安裝
[root@localhost upload]# rpm -ivh postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-libs-9.4.4-1PGDG.rhe################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-9.4.4-1PGDG.rhel6 ################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-server-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-server-9.4.4-1PGDG.r################################# [100%]
[root@localhost upload]# rpm -ivh postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
錯誤:依賴檢測失敗:
libxslt.so.1()(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.11)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.18)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
libxslt.so.1(LIBXML2_1.0.22)(64bit) 被 postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 需要
有依賴關係,用yum安裝
[root@localhost upload]# yum install libxslt
已載入外掛:fastestmirror
Could not retrieve mirrorlist error was
12: Timeout on : (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
base
| 3.6 kB 00:00:00
extras
| 3.4 kB 00:00:00
updates
| 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.163.com
* updates: mirrors.163.com
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 libxslt.x86_64.0.1.1.28-5.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
===============================================================================================================================================================================
==============================================================
Package 架構 版本
源 大小
===============================================================================================================================================================================
==============================================================
正在安裝:
libxslt x86_64 1.1.28-5.el7
base 242 k
事務概要
===============================================================================================================================================================================
==============================================================
安裝 1 軟體包
總下載量:242 k
安裝大小:486 k
Is this ok [y/d/N]: y
Downloading packages:
libxslt-1.1.28-5.el7.x86_64.rpm
| 242 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 資料庫已被非 yum 程式修改。
正在安裝 : libxslt-1.1.28-5.el7.x86_64
1/1
驗證中 : libxslt-1.1.28-5.el7.x86_64
1/1
已安裝:
libxslt.x86_64 0:1.1.28-5.el7
完畢!
[root@localhost upload]# rpm -ivh postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm
警告:postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpm: 頭V4 DSA/SHA1 Signature, 金鑰 ID 442df0f8: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:postgresql94-contrib-9.4.4-1PGDG.################################# [100%]
2、初始化DB
[root@localhost upload]su - postgres
[postgres@localhost ~]$/usr/pgsql-9.4/bin/initdb -D /var/lib/pgsql/9.4/data (此處不建議放在根目錄下)
3、啟動DB
[postgres@localhost ~]$/usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data -l logfile start
進入postgresql
[postgres@localhost ~]psql
psql (9.4.4)
輸入 "help" 來獲取幫助資訊.
postgres=# \l
資料庫列表
名稱 | 擁有者 | 字元編碼 | 校對規則 | Ctype | 存取許可權
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行記錄)
安裝成功
4、建立第二個例項
[postgres@localhost ~]$/usr/pgsql-9.4/bin/initdb -D /var/lib/pgsql/9.4/data1
5、修改第二個例項的埠
[postgres@localhost ~]cd /var/lib/pgsql/9.4/data1
[postgres@localhost data1]$ls
base pg_clog pg_hba.conf pg_logical pg_notify pg_serial pg_stat pg_subtrans pg_twophase pg_xlog postgresql.conf
global pg_dynshmem pg_ident.conf pg_multixact pg_replslot pg_snapshots pg_stat_tmp pg_tblspc PG_VERSION postgresql.auto.conf
[postgres@localhost data1]$vi postgresql.conf
port = 8801
6、啟動第二個例項
[postgres@localhost data1]$/usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data1 -l logfile start 進入第二例項
[postgres@localhost data1]$psql -p 8801 --記得帶上埠號,不然預設5432埠
psql (9.4.4)
輸入 "help" 來獲取幫助資訊.
postgres=# \l
資料庫列表
名稱 | 擁有者 | 字元編碼 | 校對規則 | Ctype | 存取許可權
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行記錄)
7、檢視例項程式
[postgres@localhost 9.4]$netstat -anpt|grep postgre
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 15425/postgres
tcp 0 0 127.0.0.1:8801 0.0.0.0:* LISTEN 15435/postgres
tcp6 0 0 :::5432 :::* LISTEN 15425/postgres
tcp6 0 0 ::1:8801 :::* LISTEN 15435/postgres
[postgres@localhost 9.4]$ps -ef |grep /usr/pgsql-9.4/bin/postgres
postgres 15425 1 0 17:14 pts/5 00:00:00 /usr/pgsql-9.4/bin/postgres -D /var/lib/pgsql/9.4/data
postgres 15435 1 0 17:14 pts/5 00:00:00 /usr/pgsql-9.4/bin/postgres -D /var/lib/pgsql/9.4/data1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29989552/viewspace-2128880/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mac安裝多個Python版本MacPython
- annacoda 安裝多個python版本Python
- 如何在一個 U 盤上安裝多個 Linux 發行版?Linux
- 雲伺服器一般安裝centos哪個版本伺服器CentOS
- 使用jEnv管理多個JDK安裝 - reflectoringJDK
- NET Core Kestrel部署HTTPS 一個伺服器綁一個證書 一個伺服器綁多個證書HTTP伺服器
- 如何在Linux上安裝一個開源VPN伺服器Linux伺服器
- postgreSQL學習(一):在Linux下安裝postgreSQLSQLLinux
- linux中安裝多個python版本環境LinuxPython
- PostgreSQL-原始碼安裝(一)SQL原始碼
- 同一個電腦安裝兩個jdk版本JDK
- R語言安裝多個版本和多版本Rstudio管理R語言
- 一臺電腦如何安裝多個版本的JDK及其說明JDK
- onethink安裝時的一個bug
- postgresql安裝(source)SQL
- Postgresql——postgis安裝SQL
- windows伺服器apache、php、postgresql的環境安裝Windows伺服器ApachePHPSQL
- PostgreSQL:Redhat 8.5 + PostgreSQL 14.5 安裝SQLRedhat
- CentOS 同時安裝多個版本的Python3CentOSPython
- 一個二維碼實現蘋果和安卓的多個應用市場安裝包自動分發蘋果安卓
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- PostgreSQL 10.12 安裝系列 - 本地RPM安裝SQL
- OpenEuler安裝配置PostgreSQLSQL
- 安裝Postgresql12.1SQL
- docker 下安裝postgresqlDockerSQL
- 原始碼安裝postgresql原始碼SQL
- postgresql 下載安裝SQL
- WAMP環境下如何安裝執行多個網站網站
- 00-macOS和Linux安裝和管理多個Python版本MacLinuxPython
- adb 可以多個視窗同時連線一個裝置嗎?
- CMake 學習【七】—— 生成一個安裝器
- linux安裝nginx時遇到的一個坑LinuxNginx
- 如何封裝一個flutter的多語言plugin封裝FlutterPlugin
- PostgreSQL 10.12 安裝系列 - Yum+rpm 安裝SQL
- Oracle同一臺伺服器建立多個資料庫Oracle伺服器資料庫
- 給你的linux伺服器安裝一個免費的防毒軟體CLAM吧!Linux伺服器防毒
- 想將多個伺服器的日誌輸出到一個地方怎麼破·?伺服器
- 多個commit合併成一個MIT
- 一個Activity顯示多個Activity