正德厚生,臻于至善

PostgreSQL RPM的安装

PostgreSQL RPM的安装
下载安装包
https://www.postgresql.org/

https://www.postgresql.org/download/linux/redhat/

# 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

使用rpm方式安装
yum源安装
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm      

安装PostgreSQL 12客户端
yum install -y postgresql12

安装PostgreSQL 12服务端
yum install -y postgresql12-server

yum install -y postgresql12 postgresql12-server

离线安装,在外网环境的同系统机器上执行
yum install -y postgresql12 --downloadonly --downloaddir=.
yum install -y postgresql12-server --downloadonly --downloaddir=.

初始化实例及服务管理
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12
systemctl stop postgresql-12

/usr/pgsql-12/bin/pg_ctl start
/usr/pgsql-12/bin/pg_ctl stop -m smart/fast/immediate

配置修改及客户端连接
vim postgresql.conf 
监听IPV4的所有IP
listen_addresses='0.0.0.0'  

vim pg_hba.conf 
host  all  all  0.0.0.0/0  md5

停止防火墙
systemctl stop firewalld

客户端
psql
pgadmin
navicat

第2个实例的创建
拷贝并修改service文件中PGDATA路径,如/var/lib/pgsql/12/data1/
cp /usr/lib/systemd/system/postgresql-12.service /usr/lib/systemd/system/db02.service

初始化数据库,并修改数据库端口,如5433
/usr/pgsql-12/bin/postgresql-12-setup initdb db02

systemctl enable db02
systemctl start db02
赞(0) 打赏
未经允许不得转载:徐万新之路 » PostgreSQL RPM的安装

评论 抢沙发

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫

微信扫一扫

登录

找回密码

注册