客服微信
本文为云贝教育 刘峰 原创,请尊重知识产权,转发请注明出处,不接受任何抄袭、演绎和未经注明出处的转载。
PG15安装之RPM安装
一、安装准备
1.1 软件下载链接
https://www.postgresql.org/download/
1.2 选择版本
这里我们选择红帽版本
1.3 选择RPM包版本
我们这里选择rhel7-64位-pg15
二、安装数据库
命令如下:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo yum install -y postgresql15-server sudo /usr/pgsql-15/bin/postgresql-15-setup initdb sudo systemctl enable postgresql-15 sudo systemctl start postgresql-15
三、查看安装目录
数据库安装好之后,会自动创建postgres用户
切换到postgres用户,查看目录架构
su - postgres
-bash-4.2$ tree -L 3 . └── 15 ├── backups ├── data │ ├── base │ ├── current_logfiles │ ├── global │ ├── log │ ├── pg_commit_ts │ ├── pg_dynshmem │ ├── pg_hba.conf │ ├── pg_ident.conf │ ├── pg_logical │ ├── pg_multixact │ ├── pg_notify │ ├── pg_replslot │ ├── pg_serial │ ├── pg_snapshots │ ├── pg_stat │ ├── pg_stat_tmp │ ├── pg_subtrans │ ├── pg_tblspc │ ├── pg_twophase │ ├── PG_VERSION │ ├── pg_wal │ ├── pg_xact │ ├── postgresql.auto.conf │ ├── postgresql.conf │ ├── postmaster.opts │ └── postmaster.pid └── initdb.log
四、解决依赖关系报错
如果有依赖关系报错,如
Error: Package: postgresql15-server-15.4-1PGDG.rhel7.x86_64 (pgdg15) Requires: libzstd.so.1()(64bit)
下载以下安装包再次执行安装即可
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libzstd-1.5.5-1.el7.x86_64.rpm wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-devel-5.0.1-7.el7.x86_64.rpm wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-5.0.1-7.el7.x86_64.rpm wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-libs-5.0.1-7.el7.x86_64.rpm yum install -y ./libzstd-1.5.5-1.el7.x86_64.rpm yum install -y centos-release-scl-rh llvm5*