精选
推荐文章

linux安装PostgreSQL的方法指南

mini云码 发布日期: 2025-11-18 19:07


PostgreSQL的安装,由于需要安装比较多依赖,因此,今天整理下,PostgreSQL的安装过程。

(1)从官方安装rpm:

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm

(2)禁用系统自带的

#如报错没有dnf命令可无视,继续向下执行
sudo dnf -qy module disable postgresql

(3)使用yum安装postgresql

sudo yum install -y postgresql15 postgresql15-server

(4)设置开机自动启动

sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15

好了,这样就完成安装了。可以使用命令登录:


psql -U postgres -d postgres