SEO Spider

Configure X Virtual Framebuffer

Configure X Virtual Framebuffer

When running headless on Linux, a display is needed if you want to use the Embedded Browser to do JavaScript rendering. You can use a Virtual Frame Buffer to simulate having a display attached, useful when running on AWS for example. The SEO Spider expects this to be DISPLAY=:0.

Installation

Install the required package via the command line:

sudo apt-get install -y xvfb

Configuration

Copy and paste the following on the command line to configure the service:
sudo tee /etc/systemd/system/xvfb.service <<HERE > /dev/null
[Unit]
Description=X Virtual Frame Buffer Service
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :0 -screen 0 1024x768x24
[Install]
WantedBy=multi-user.target
HERE

Service Registration

Now register and start the service.
sudo systemctl enable /etc/systemd/system/xvfb.service
sudo systemctl start xvfb.service
sudo systemctl enable xvfb

Then set this as the display to use.
echo "export DISPLAY=:0" >> ~/.bashrc
source ~/.bashrc

Join the mailing list for updates, tips & giveaways

Back to top