sudo yum install -y https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
404 找不到链接
在尝试安装 PostgreSQL 14 的 Yum 仓库时遇到 404 错误,可能是因为该链接已被更新或不再可用。可以尝试以下步骤来获取最新的 PostgreSQL Yum 仓库链接:
步骤 1: 查找最新的 PostgreSQL Yum 仓库链接
访问 PostgreSQL 官方网站的 Yum 仓库页面,获取最新的链接:
在该页面中,选择适合 CentOS 7 的版本,找到 PostgreSQL 14 的 Yum 仓库链接。
步骤 2: 使用新的链接安装 Yum 仓库
假设找到了新的链接,使用以下命令替换为你找到的链接:
sudo yum install -y <新链接>
示例
如果找到的链接是:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-7-x86_64/pgdg-redhat-repo-14-2.noarch.rpm
步骤 3: 继续安装 PostgreSQL 14
一旦成功安装了 Yum 仓库,可以继续执行之前的步骤来禁用默认模块、安装 PostgreSQL 14、初始化数据库等。
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql14-server
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable postgresql-14
sudo systemctl start postgresql-14
postgresql-setup --initdb
systemctl enable postgresql.service
systemctl start postgresql.service