centos8安装PostgreSQL 15.3编译安装

1.PGSQL官网下载PGSQL源码编译包安装相关依赖包

`[root@localhost ~]# wget https://ftp.postgresql.org/pub/source/v15.3/postgresql-15.3.tar.gz --no-check-certificate`
yum install gcc make -y

在这里插入图片描述

2 创建用户和组及存储文件夹路径和授权

groupadd pgsql
useradd pgsql -g pgsql
mkdir  -p /data/{pgsql,pgdata} ##pgsqldata数据目录  pgsql存放二进制文件
chown -R pgsql:pgsql /data

![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/c138b884229d4631937a3c8feebf3034.png

3 解压源码包到指定的文件目录及编译安装

[root@localhost ~]# tar xf postgresql-15.3.tar.gz -C /data/
[root@localhost ~]# cd /data/
[root@localhost data]# ls
pgdata  pgsql  postgresql-15.3
[root@localhost data]# cd postgresql-15.3/
[root@localhost postgresql-15.3]# 
[root@localhost postgresql-15.3]# ./configure --prefix=/data/pgsql --without-readline --without-zlib  .预编译源码
[root@localhost postgresql-15.3]# make && make install  .编译安装


在这里插入图片描述

4 配置环境变量及pgsql数据库初始化

vi /etc/profile
PATH=/data/pgsql/bin:$PATH
export PATH
在这里插入图片描述

5 切换到指定用户

su - pgsql

6 切换到指定目录

cd /data/pgsql/bin/

7 执行数据库初始化 指定数据库文件目录 及启动数据库

./initdb -D /data/pgdata

##############################################################
Success. You can now start the database server using:
 
    ./pg_ctl -D /usr/local/postgresql/data -l logfile start 

在这里插入图片描述
已启动成功
在这里插入图片描述

8 创建PGSQL数据库pgsql用户及修改密码

alter user pgsql with password ‘pgsql1234’;
在这里插入图片描述

8修改pg_hba.conf文件添加一行 及认证方式

echo “host all all 0.0.0.0/0 md5” >> pg_hba.conf
在这里插入图片描述

9修改postgresql.conf中的监听地址保存重启

listen_addresses = ‘*’ #监听IP
max_connections = 300 #最大连接数,可根据业务需要修改

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

加油干sit!

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

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

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

打赏作者

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

抵扣说明:

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

余额充值