How to install Xvfb and create systemd Xvfb service on CentOS 7 / 8 or RHEL 7 / 8

How to install Xvfb and create systemd Xvfb service on CentOS 7 / 8 or RHEL 7 / 8

Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol.

In contrast to other display servers, Xvfb performs all graphical operations in virtual memory without showing any screen output.

From the point of view of the client, it acts exactly like any other X display server, serving requests and sending events and errors as appropriate.

However, no output is shown.

This virtual server does not require the computer it is running on to have any kind of graphics adapter, a screen or any input device. Only a network layer is necessary.

Read more about Xvfb on Wikipedia

How to Install Xfvb on CentOS 7 / 8 or RHEL 7 / 8

# yum install xorg-x11-server-Xvfb

Create systemd xvfb service on CentOS 7 / 8 or RHEL 7 / 8

# vi /etc/systemd/system/xvfb.service

Paste code below

[Unit]
Description=Xvfb headless plotting
After=network.target

[Service]
User=root
ExecStart=/usr/bin/Xvfb :0 -screen 0 1280x1024x24

[Install]
WantedBy=multi-user.target
Alias=Xvfb.service
Alias=xvfbd.service

Make excecutabe /etc/systemd/system/xvfb.service and reload systemd daemon with command

# chmod +x /etc/systemd/system/xvfb.service
# systemctl daemon-reload

Enable and start xvfb.service

# systemctl enable xvfb.service
# systemctl start xvfb.service

To check status of xvfb

# systemctl status xvfb.service

Leave a Reply

Your email address will not be published. Required fields are marked *