CentOS7.9部署PostgreSQL

CentOS7.9 部署PostgreSQL

前言

本文主要介绍一下, CentOS部署 PostgreSQL

1.1 安装包下载

通过官网下载源码安装包
本文选择 postgresql-14.11.tar.gz 进行测试
在这里插入图片描述

1.2 安装依赖

新系统是最小化安装,所有存了安装一些必要的依赖,同时安装了一些小工具。

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# rm -rf *
[root@localhost ~]# curl http://mirrors.aliyun.com/repo/Centos-7.repo  > /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum install -y cmake make gcc zlib gcc-c++ perl readline readline-devel
[root@localhost ~]# yum install -y zlib libicu 
[root@localhost ~]# yum install -y zlib-devel perl python36 tcl openssl ncurses-devel openldap pam openssl-devel
[root@localhost ~]# yum -y install lrzsz
[root@localhost ~]# yum -y install vim ntp net-tools 

1.3 同步时间

[root@localhost ~]# ntpdate ntp.aliyun.com

1.4 创建用户

创建用户
groupadd -g 60000 postgres
useradd -u 60000 -g postgres postgres
echo "postgres" | passwd --stdin postgres

1.5 创建用户组

mkdir -p /dbs/pg14/data
mkdir -p /pg14/soft
chown -R postgres:postgres /dbs 
chown -R postgres:postgres /pg14
chmod -R 775 /pg14
chmod -R 775 /dbs 

1.6 编译安装

su - postgres
cp /tmp/postgresql-14.11.tar.gz /pg14/soft
cd /pg14/soft
tar -zxvf postgresql-14.11.tar.gz
cd postgresql-14.11
./configure --prefix=/pg14/soft --with-openssl
make && make install

1.7 添加环境变量

cat >> ~/.bash_profile <<"EOF"
export PGPORT=5666
export PGDATA=/dbs/pg14/data
export PGHOME=/pg14/soft
export PATH=$PGHOME/bin:$PATH:.
EOF
source  ~/.bash_profile

总结

目前PostgreSQL 已完成初步安装。
后续使用,需要先初始化,并启动psql服务。
并按需配置。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云计算老王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值