CentOS 7.9 安装postgreSQL数据库
查看系统版本
一、切换安装源
官方的PGDG源已经下线,需要切换成国内的镜像源
1、删掉无效的repo
rm -f /etc/yum.repos.d/pgdg*.repo
2、新建阿里云 PostgreSQL 15 源
vim /etc/yum.repos.d/pgdg15-aliyun.repo
写入
[pgdg15] name=PostgreSQL 15 for RHEL/CentOS 7 - Aliyun baseurl=https://mirrors.aliyun.com/postgresql/repos/yum/15/redhat/rhel-7-x86_64/ enabled=1 gpgcheck=0保存退出
3、清理缓存并安装
yum clean all yum makecache yum install -y postgresql15-server4、初始化并启动
/usr/pgsql-15/bin/postgresql-15-setup initdb systemctl enable postgresql-15 systemctl start postgresql-15 systemctl status postgresql-15至此安装OK
