赞
踩
双击打开安装包,点击Next。
选择安装路径,点击Next。
点击Next
点击Next设置数据存放目录,点击Next。
设置数据库密码,用户名默认postgres,点击Next。
设置数据库端口,默认5432,点击Next。
点击Next
点击Next
等待安装
点击Finish
选择PostgreSQL,点击下一个
选择语言包,点击下一个
点击下一个
弹出正在下载窗口。(如果下载超时,会返回到上一步,继续点下一个,下载成功为止)
点击下一个
选择语言,点击OK
点击Next
点击Next
点击Next
等待安装
点击Finish
点击完成
win + s 快捷键,查询pgAdmin。
可以看到PostgreSQL的欢迎界面
输入管理密码,如果之前没有,可以点击下方 Reset Master Password 进行重设。
点击Servers,输入安装PostgreSQL时设置的密码,连接数据库。
点击Dashboard,选择数据库,可以看到数据库的实时状态。
win + s 快捷键,查询psql。**
一直回车,直到提示输入密码。
输入密码,回车。
连接成功,进入数据库命令行。
- [root@localhost ~]# sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
- Loaded plugins: fastestmirror, langpacks
- pgdg-redhat-repo-latest.noarch.rpm | 8.6 kB 00:00:00
- Examining /var/tmp/yum-root-sW1lCJ/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-32.noarch
- Marking /var/tmp/yum-root-sW1lCJ/pgdg-redhat-repo-latest.noarch.rpm to be installed
- Resolving Dependencies
- --> Running transaction check
- ---> Package pgdg-redhat-repo.noarch 0:42.0-32 will be installed
- --> Finished Dependency Resolution
- base/7/x86_64 | 3.6 kB 00:00:00
- base/7/x86_64/group_gz | 153 kB 00:00:01
- base/7/x86_64/primary_db | 6.1 MB 00:00:06
- extras/7/x86_64 | 2.9 kB 00:00:00
- extras/7/x86_64/primary_db | 250 kB 00:00:00
- updates/7/x86_64 | 2.9 kB 00:00:00
- updates/7/x86_64/primary_db | 22 MB --:--:--
-
-
- Dependencies Resolved
-
-
- ==========================================================================================================================================================================================================
- Package Arch Version Repository Size
- ==========================================================================================================================================================================================================
- Installing:
- pgdg-redhat-repo noarch 42.0-32 /pgdg-redhat-repo-latest.noarch 13 k
-
-
- Transaction Summary
- ==========================================================================================================================================================================================================
- Install 1 Package
-
-
- Total size: 13 k
- Installed size: 13 k
- Downloading packages:
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : pgdg-redhat-repo-42.0-32.noarch 1/1
- Verifying : pgdg-redhat-repo-42.0-32.noarch 1/1
-
-
- Installed:
- pgdg-redhat-repo.noarch 0:42.0-32
-
-
- Complete!
- # Install PostgreSQL:
- sudo yum install -y postgresql15-server
-
- [root@localhost ~]# sudo yum install -y postgresql15-server
- Loaded plugins: fastestmirror, langpacks
- Loading mirror speeds from cached hostfile
- * base: mirrors.ustc.edu.cn
- * extras: mirrors.aliyun.com
- * updates: mirrors.aliyun.com
- pgdg-common/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg-common/7/x86_64/signature | 2.9 kB 00:00:00 !!!
- pgdg11/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg11/7/x86_64/signature | 3.6 kB 00:00:00 !!!
- pgdg12/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg12/7/x86_64/signature | 3.6 kB 00:00:00 !!!
- pgdg13/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg13/7/x86_64/signature | 3.6 kB 00:00:00 !!!
- pgdg14/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg14/7/x86_64/signature | 3.6 kB 00:00:00 !!!
- pgdg15/7/x86_64/signature | 198 B 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- pgdg15/7/x86_64/signature | 3.6 kB 00:00:00 !!!
- (1/11): pgdg12/7/x86_64/group_gz | 245 B 00:00:01
- (2/11): pgdg13/7/x86_64/group_gz | 246 B 00:00:00
- (3/11): pgdg-common/7/x86_64/primary_db | 191 kB 00:00:03
- (4/11): pgdg14/7/x86_64/group_gz | 244 B 00:00:00
- (5/11): pgdg13/7/x86_64/primary | 316 kB 00:00:03
- (6/11): pgdg15/7/x86_64/group_gz | 246 B 00:00:00
- (7/11): pgdg11/7/x86_64/primary_db | 510 kB 00:00:05
- (8/11): pgdg15/7/x86_64/primary_db | 132 kB 00:00:01
- (9/11): pgdg14/7/x86_64/primary_db | 219 kB 00:00:02
- (10/11): pgdg11/7/x86_64/group_gz | 245 B 00:00:06
- (11/11): pgdg12/7/x86_64/primary_db | 397 kB 00:00:08
- Resolving Dependencies
- --> Running transaction check
- ---> Package postgresql15-server.x86_64 0:15.4-1PGDG.rhel7 will be installed
- --> Processing Dependency: postgresql15-libs(x86-64) = 15.4-1PGDG.rhel7 for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: postgresql15(x86-64) = 15.4-1PGDG.rhel7 for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: libzstd.so.1()(64bit) for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: libpq.so.5()(64bit) for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Running transaction check
- ---> Package postgresql15.x86_64 0:15.4-1PGDG.rhel7 will be installed
- --> Processing Dependency: libzstd >= 1.4.0 for package: postgresql15-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: libzstd.so.1()(64bit) for package: postgresql15-15.4-1PGDG.rhel7.x86_64
- ---> Package postgresql15-libs.x86_64 0:15.4-1PGDG.rhel7 will be installed
- ---> Package postgresql15-server.x86_64 0:15.4-1PGDG.rhel7 will be installed
- --> Processing Dependency: libzstd.so.1()(64bit) for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Finished Dependency Resolution
- Error: Package: postgresql15-server-15.4-1PGDG.rhel7.x86_64 (pgdg15)
- Requires: libzstd.so.1()(64bit)
- Error: Package: postgresql15-15.4-1PGDG.rhel7.x86_64 (pgdg15)
- Requires: libzstd.so.1()(64bit)
- Error: Package: postgresql15-15.4-1PGDG.rhel7.x86_64 (pgdg15)
- Requires: libzstd >= 1.4.0
- You could try using --skip-broken to work around the problem
- You could try running: rpm -Va --nofiles --nodigest
报错提示缺少环境依赖包 libzstd.so.1(),安装以下包文件
yum install epel-release.noarch -y
yum install libzstd.x86_64 -y
如果离线,依赖包下载(CentOS7 x86_64):
epel-release:https://centos.pkgs.org/7/centos-extras-x86_64/epel-release-7-11.noarch.rpm.html
libzstd:https://rhel.pkgs.org/7/epel-x86_64/libzstd-1.5.5-1.el7.x86_64.rpm.html
注意前置依赖环境
- [root@localhost ~]# yum install epel-release.noarch -y
- Loaded plugins: fastestmirror, langpacks
- Loading mirror speeds from cached hostfile
- * base: mirrors.bfsu.edu.cn
- * extras: mirrors.bfsu.edu.cn
- * updates: mirrors.cqu.edu.cn
- Resolving Dependencies
- --> Running transaction check
- ---> Package epel-release.noarch 0:7-11 will be installed
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- ====================================================================================================================================================
- Package Arch Version Repository Size
- ====================================================================================================================================================
- Installing:
- epel-release noarch 7-11 extras 15 k
-
- Transaction Summary
- ====================================================================================================================================================
- Install 1 Package
-
- Total download size: 15 k
- Installed size: 24 k
- Downloading packages:
- warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
- Public key for epel-release-7-11.noarch.rpm is not installed
- epel-release-7-11.noarch.rpm | 15 kB 00:00:00
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
- Importing GPG key 0xF4A80EB5:
- Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
- Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
- Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : epel-release-7-11.noarch 1/1
- Verifying : epel-release-7-11.noarch 1/1
- Installed:
- epel-release.noarch 0:7-11
- Complete!
- [root@localhost ~]# yum install libzstd.x86_64 -y
- Loaded plugins: fastestmirror, langpacks
- Loading mirror speeds from cached hostfile
- epel/x86_64/metalink | 8.0 kB 00:00:00
- * base: mirrors.tuna.tsinghua.edu.cn
- * epel: mirrors.tuna.tsinghua.edu.cn
- * extras: mirrors.cqu.edu.cn
- * updates: mirrors.tuna.tsinghua.edu.cn
- epel | 4.7 kB 00:00:00
- (1/3): epel/x86_64/group_gz | 99 kB 00:00:01
- (2/3): epel/x86_64/updateinfo | 1.0 MB 00:00:02
- (3/3): epel/x86_64/primary_db | 7.0 MB 00:00:05
- Resolving Dependencies
- --> Running transaction check
- ---> Package libzstd.x86_64 0:1.5.5-1.el7 will be installed
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- ====================================================================================================================================================Package Arch Version Repository Size
- ====================================================================================================================================================
- Installing:
- libzstd x86_64 1.5.5-1.el7 epel 292 k
-
- Transaction Summary
- ====================================================================================================================================================
- Install 1 Package
-
- Total download size: 292 k
- Installed size: 775 k
- Downloading packages:
- warning: /var/cache/yum/x86_64/7/epel/packages/libzstd-1.5.5-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY========================== ] 78 kB/s | 258 kB 00:00:00 ETA
- Public key for libzstd-1.5.5-1.el7.x86_64.rpm is not installed
- libzstd-1.5.5-1.el7.x86_64.rpm | 292 kB 00:00:01
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
- Importing GPG key 0x352C64E5:
- Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
- Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
- Package : epel-release-7-11.noarch (@extras)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : libzstd-1.5.5-1.el7.x86_64 1/1
- Verifying : libzstd-1.5.5-1.el7.x86_64 1/1
-
- Installed:
- libzstd.x86_64 0:1.5.5-1.el7
-
- Complete!
再次安装
yum install -y postgresql15-server
- [root@localhost ~]# sudo yum install -y postgresql15-server
- Loaded plugins: fastestmirror, langpacks
- Loading mirror speeds from cached hostfile
- * base: mirrors.bupt.edu.cn
- * epel: mirrors.tuna.tsinghua.edu.cn
- * extras: mirrors.bupt.edu.cn
- * updates: mirrors.tuna.tsinghua.edu.cn
- Resolving Dependencies
- --> Running transaction check
- ---> Package postgresql15-server.x86_64 0:15.4-1PGDG.rhel7 will be installed
- --> Processing Dependency: postgresql15-libs(x86-64) = 15.4-1PGDG.rhel7 for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: postgresql15(x86-64) = 15.4-1PGDG.rhel7 for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Processing Dependency: libpq.so.5()(64bit) for package: postgresql15-server-15.4-1PGDG.rhel7.x86_64
- --> Running transaction check
- ---> Package postgresql15.x86_64 0:15.4-1PGDG.rhel7 will be installed
- ---> Package postgresql15-libs.x86_64 0:15.4-1PGDG.rhel7 will be installed
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- ====================================================================================================================================================
- Package Arch Version Repository Size
- ====================================================================================================================================================
- Installing:
- postgresql15-server x86_64 15.4-1PGDG.rhel7 pgdg15 5.7 M
- Installing for dependencies:
- postgresql15 x86_64 15.4-1PGDG.rhel7 pgdg15 1.6 M
- postgresql15-libs x86_64 15.4-1PGDG.rhel7 pgdg15 284 k
-
- Transaction Summary
- ====================================================================================================================================================
- Install 1 Package (+2 Dependent packages)
-
- Total download size: 7.5 M
- Installed size: 33 M
- Downloading packages:
- warning: /var/cache/yum/x86_64/7/pgdg15/packages/postgresql15-libs-15.4-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY ] 111 kB/s | 207 kB 00:01:07 ETA
- Public key for postgresql15-libs-15.4-1PGDG.rhel7.x86_64.rpm is not installed
- (1/3): postgresql15-libs-15.4-1PGDG.rhel7.x86_64.rpm | 284 kB 00:00:02
- (2/3): postgresql15-15.4-1PGDG.rhel7.x86_64.rpm | 1.6 MB 00:00:10
- (3/3): postgresql15-server-15.4-1PGDG.rhel7.x86_64.rpm | 5.7 MB 00:00:26
- ----------------------------------------------------------------------------------------------------------------------------------------------------
- Total 263 kB/s | 7.5 MB 00:00:29
-
- Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Importing GPG key 0x442DF0F8:
- Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
- Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
- Package : pgdg-redhat-repo-42.0-32.noarch (@/pgdg-redhat-repo-latest.noarch)
- From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : postgresql15-libs-15.4-1PGDG.rhel7.x86_64 1/3
- Installing : postgresql15-15.4-1PGDG.rhel7.x86_64 2/3
- Installing : postgresql15-server-15.4-1PGDG.rhel7.x86_64 3/3
- Verifying : postgresql15-libs-15.4-1PGDG.rhel7.x86_64 1/3
- Verifying : postgresql15-server-15.4-1PGDG.rhel7.x86_64 2/3
- Verifying : postgresql15-15.4-1PGDG.rhel7.x86_64 3/3
-
- Installed:
- postgresql15-server.x86_64 0:15.4-1PGDG.rhel7
-
- Dependency Installed:
- postgresql15.x86_64 0:15.4-1PGDG.rhel7 postgresql15-libs.x86_64 0:15.4-1PGDG.rhel7
-
- Complete!
- # Optionally initialize the database and enable automatic start:
- sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
- sudo systemctl enable postgresql-15
- sudo systemctl start postgresql-15
-
- [root@localhost ~]# sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
- Initializing database ... OK
- [root@localhost ~]# sudo systemctl enable postgresql-15
- Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-15.service to /usr/lib/systemd/system/postgresql-15.service.
- [root@localhost ~]# sudo systemctl start postgresql-15
感谢 PostgreSQL中文社区:PostgreSQL中文社区:: 世界上功能最强大的开源数据库...
感谢 民工哥技术之路 https://zhuanlan.zhihu.com/p/645899384
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。