Install Xvfb on CentOS

https://www.notion.so/Install-Xvfb-on-CentOS-2a01f24a9e694e78bf725a61883356b8

Xvfb, or X virtual frame buffer is needed by selenium and chromedriver or gekodriver, so it can run via cron with your PC locked, or without your script taking focus from the user section.

Installing

1
yum install xorg-x11-server-Xvfb

Copy below to /etc/systemd/system/Xvfb.service

1
2
3
4
5
6
7
8
9
[Unit]
Description=X Virtual Frame Buffer Service
After=network.target

[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24

[Install]
WantedBy=multi-user.target
1
2
3
chmod +x /etc/systemd/system/Xvfb.service
systemctl enable Xvfb.service
systemctl start Xvfb.service
This post is licensed under CC BY 4.0 by the author.