文章目录
- 安装Server
- 配置数据目录
- 创建数据存储目录
- 配置环境变量,数据目录
- Reload systemd
- 初始化DB
- 启动数据库
- 安装模块包
- postgresql14-contrib
- postgresql14-devel
安装Server
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 postgresql14-server
配置数据目录
创建数据存储目录
mkdir -p /data/psql-14
chown -R postgres:postgres /data/psql-14
配置环境变量,数据目录
sudo systemctl edit postgresql-14.service
[Service]
Environment=PGDATA=/data/psql-14/data
cat /etc/systemd/system/postgresql-14.service.d/override.conf
Reload systemd
systemctl daemon-reload
初始化DB
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
启动数据库
sudo systemctl start postgresql-14
安装模块包
postgresql14-contrib
yum install postgresql14-contrib.x86_64
postgresql14-devel
yum install postgresql14-devel.x86_64
备注:如果安装devel模块包包错缺少llvm包,可以执行以下下载:
llvm5.0-devel 、 llvm5.0 、llvm5.0-libs
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-devel-5.0.1-7.el7.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-5.0.1-7.el7.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-libs-5.0.1-7.el7.x86_64.rpm
yum localinstall llvm5.0*.rpm