3

哪些 PostgreSQL 客户端可通过 microdnf 安装获得?我正在尝试通过我的 Dockerfile 安装客户端。

我已经尝试了多个我推荐的命令和几个猜测,但没有一个对我有用:

microdnf install -y postgresql-client
microdnf install -y postgresql
microdnf install -y psql
etc.

正在使用的图像: https ://hub.docker.com/r/jboss/keycloak/

sh-4.4$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.3 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.3"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.3 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.3:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.3"

PS = 有没有我可以访问的网站查看可用软件包的完整列表?

4

2 回答 2

1

我有同样的问题,但使用mavendocker 镜像(它基于 OracleLinux 8)。

Oracle Linux 8 和 Postgresql13 客户端

在上面安装 postgresql 客户端是非常不寻常的,所以,让我们考虑一下我的步骤:

  1. https://www.postgresql.org/download/linux/redhat/
    选择RHEL 8,收到rpm包链接

  2. 手动安装它rpm

microdnf install -y wget
wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm -O /tmp/pg_repo.rpm
rpm -i /tmp/pg_repo.rpm
  1. 确定没有postgresql13包。点击直接下载链接,选择RHEL 8:https ://download.postgresql.org/pub/repos/yum/13/redhat/rhel-8-x86_64/

  2. 下载postgresql13-13.x.x...包(最新)

wget https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-8-x86_64/postgresql13-13.3-2PGDG.rhel8.x86_64.rpm -O /tmp/pgql.rpm

该 rpm 的依赖项列表:

libicu is needed by postgresql13-13.3-2PGDG.rhel8.x86_64
        libpq.so.5()(64bit) is needed by postgresql13-13.3-2PGDG.rhel8.x86_64
        postgresql13-libs(x86-64) = 13.3-2PGDG.rhel8 is needed by postgresql13-13.3-2PGDG.rhel8.x86_64
        systemd is needed by postgresql13-13.3-2PGDG.rhel8.x86_64
        systemd-sysv is needed by postgresql13-13.3-2PGDG.rhel8.x86_64
  1. 安装依赖项
microdnf install -y systemd postgresql13-libs libicu
  1. 最后安装客户端
rpm -i /tmp/pgql.rpm

现在您可以清除缓存并测试客户端,例如pg_dump命令。

结果 Dockerfile 命令:

RUN microdnf install -y wget && \
    wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm -O /tmp/pg_repo.rpm && \
    rpm -i /tmp/pg_repo.rpm && \
    microdnf install -y systemd postgresql13-libs libicu && \
    wget https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-8-x86_64/postgresql13-13.3-2PGDG.rhel8.x86_64.rpm -O /tmp/pgql.rpm && \
    rpm -i /tmp/pgql.rpm && \
    rm -f /tmp/pg_repo.rpm /tmp/pgql.rpm && \
    microdnf remove -y wget

RHEL 8 和 Postgresql13 客户端(您的情况)

现在让我们考虑您的情况,jboss/keycloak:14.0.0基于 RHEL 8 的图像。

警告:如果您收到错误消息error: Failed to create: /var/cache/yum/metadata,请以 root 用户身份运行,然后将用户切换回 jboss。

所有步骤和 Dockerfile 命令都是一样的。

请让我知道是否有任何错误或没有很好地描述。

于 2021-07-01T21:17:02.107 回答
0

它适用于我使用基于 openjdk:15 的 Dockerfile。

FROM openjdk:15.0.1-oracle
...
RUN microdnf update
RUN microdnf module enable postgresql:13
RUN microdnf install postgresql.x86_64
于 2021-11-03T10:06:26.963 回答