- 在聯網的機器上安裝
postgresql yum 源
,官網鏈接
[root@localhost yum.repos.d]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm
或者
[root@localhost]# wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-42.0-4.noarch.rpm
[root@localhost]# rpm -ivh pgdg-redhat-repo-42.0-4.noarch.rpm
- 替換
$releasever
為系統版本號
[root@localhost yum.repos.d]# sed -i 's/$releasever/6/g' /etc/yum.repos.d/pgdg-redhat-all.repo
- 安裝依賴
[root@localhost]# yum install --downloadonly --downloaddir=psql10 libicu postgresql10-libs
- 安裝軟件包
[root@localhost]# yum install --downloadonly --downloaddir=psql10 postgresql10 postgresql10-server
- 初始化數據庫並啟用自動啟動:
service postgresql-10 initdb
chkconfig postgresql-10 on
service postgresql-10 start
- 離線安裝下載完成的
rpm
包
[root@bogon psql10]# ll
總用量 12208
-rw-r--r-- 1 root root 5157464 7月 23 2019 libicu-4.2.1-14.el6.x86_64.rpm
-rw-r--r-- 1 root root 1702904 7月 23 2019 postgresql10-10.9-1PGDG.rhel6.x86_64.rpm
-rw-r--r-- 1 root root 333504 7月 23 2019 postgresql10-libs-10.9-1PGDG.rhel6.x86_64.rpm
-rw-r--r-- 1 root root 5299092 7月 23 2019 postgresql10-server-10.9-1PGDG.rhel6.x86_64.rpm
- 使用數據庫
su - postgres
psql