2

I need to install Xvfb on Redhat 8, however the usual way doesn't work:

yum -y install xorg-x11-server-Xvfb

No match for argument: xorg-x11-server-Xvfb

Error: Unable to find a match: xorg-x11-server-Xvfb

From here How to install Xvfb (X virtual framebuffer) on Redhat 6.5? I tried the suggestion:

wget http://vault.centos.org/6.2/os/x86_64/Packages/xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64.rpm
yum localinstall xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64.rpm

But that gives:

Error: Problem: conflicting requests

  • nothing provides libXdmcp.so.6()(64bit) needed by xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64
  • nothing provides libXfont.so.1()(64bit) needed by xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64
  • nothing provides libcrypto.so.10()(64bit) needed by xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64
  • nothing provides xorg-x11-server-common >= 1.10.4-6.el6 needed by xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64

Is there any way to install Xvfb on RH8?

automaton
  • 1,972
  • 5
  • 25
  • 40

3 Answers3

3

Create the file /etc/yum.repos.d/centos8.repo

[CentOS-8]
name=CentOS-8
baseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/
enabled=1
gpgcheck=1
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official

Then:

rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
dnf install -y xorg-x11-server-Xvfb

If you are trying to run something like cypress headless, you might also need some of these:

atk java-atk-wrapper at-spi2-atk gtk3 libXt mesa-libgbm libdrm
user2163960
  • 1,871
  • 19
  • 22
  • it says This command has to be run with superuser privileges (under the root user on most systems). you have any other way around, thanks – Avinash jain Sep 07 '22 at 10:44
1

The only way to do this (without an RHEL subscription) is to do the following installs which work only when in this order:

yum install -y libXScrnSaver \
mesa-libgbm nss at-spi2-atk libX11-xcb \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/libxkbfile-1.0.9-9.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/xorg-x11-xkb-utils-7.7-26.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/xorg-x11-server-common-1.20.2-5.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/xorg-x11-xauth-1.0.9-12.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/libXdmcp-1.1.2-11.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/libXfont2-2.0.3-2.el8.x86_64.rpm \
ftp://ftp.redhat.com/pub/redhat/rhel/rhel-8-beta/appstream/x86_64/Packages/xorg-x11-server-Xvfb-1.20.2-5.el8.x86_64.rpm;

I don't know why it's so difficult.

automaton
  • 1,972
  • 5
  • 25
  • 40
  • it says This command has to be run with superuser privileges (under the root user on most systems). did you have any other way of doing it @automaton – Avinash jain Sep 07 '22 at 10:43
1

The following docker file fixed it for us using UBI 8 openjdk.

We added the CentOS repository and enabled it.

FROM registry.access.redhat.com/ubi8/openjdk-8

USER 0

RUN adduser --system non-root

ARG CERTIFICATES_DIR

# Copy root CA certs
COPY ${CERTIFICATES_DIR}/AAAAAAAAAAAA.crt /etc/pki/ca-trust/source/anchors/
COPY ${CERTIFICATES_DIR}/BBBBBBBBBBBB.crt /etc/pki/ca-trust/source/anchors/
COPY ${CERTIFICATES_DIR}/CCCCCCCCCCCCC.crt /etc/pki/ca-trust/source/anchors/

# Install CA certs
RUN update-ca-trust

RUN mkdir /app && chmod g+rwx /app

ARG APPLICATION_CLASS
ENV APPLICATION_CLASS=${APPLICATION_CLASS}

ARG DEPENDENCY_DIR

COPY ${DEPENDENCY_DIR}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY_DIR}/META-INF /app/META-INF
COPY ${DEPENDENCY_DIR}/BOOT-INF/classes /app


RUN chmod -R g+rwx /app/*

RUN printf '[CentOS-8]\nname=CentOS-8\nbaseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/\nenabled=1\ngpgcheck=1\ngpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official' >> /etc/yum.repos.d/ubi.repo

RUN microdnf -y update && \
    microdnf -y install freetype fontconfig dejavu-sans-mono-fonts dejavu-serif-fonts dejavu-sans-fonts xorg-x11-server-Xvfb && microdnf clean all


RUN fc-cache --really-force --verbose


RUN mkdir /tmp/.X11-unix \
    && chmod 1777 /tmp/.X11-unix \
    && chown root:root /tmp/.X11-unix/

ENV LANG "en_US.UTF-8"
ENV LC_ALL "en_US.ISO8859-1"
ENV TZ "Europe/Stockholm"
ENV DISPLAY ":99"


USER non-root

EXPOSE 8080 8443

WORKDIR /

ENTRYPOINT ["sh", "-c", "java -cp app:app/lib/* ${PISA_JAVA_OPTS} ${JAVA_OPTIONS} ${APPLICATION_CLASS} & \
                         Xvfb ${DISPLAY} >> /app/kola/xvfb.log 2>&1"]
JCompetence
  • 6,997
  • 3
  • 19
  • 26