centos7下 postgresql-12的安装及卸载方法

一、centos7 postgresql-12的预安装版本的安装方法:

# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
sudo yum install -y postgresql12-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12

二、postgresql-12 源码安装方式:

1 下载

官网提供了源码和预安装的版本。 源码需要编译安装,解决依赖包等问题,而预安装的版本要简单很多。只需下载解压, 初始化数据库即可。
本例以源码安装为例:请至官网 下载源码。
本例中安装的是PG12. 在 https://www.postgresql.org/ftp/source/v12.0/ 中选择postgresql-12.0.tar.bz2
请根据需要先择自己需要的版本。
预安装版本,请至官网下载。

准备环境

此步骤以root用户执行。 将postgresql的安装包放到/opt 路径。

# 创建组和用户
groupadd postgre
useradd -g postgre -G postgre -d /home/postgresql postgre
passwd postgre
# 安装依赖包
yum install -y bzip2 readline-devel zlib-devel
# 将安装包放在/opt 路径中并解压
cd /opt/
bunzip2 postgresql-12.0.tar.bz2
tar -xvf ./postgresql-12.0.tar

编译安装

此步骤以postgre 用户操作:

cd /opt/postgresql-12.0
./configure --prefix=/home/postgresql/dbhome
make && make install

安装后,可执行文件,库文件等都会安装在/home/postgresql/dbhome 中。


                
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值