
We will show you how to install Xvfb (X virtual framebuffer) on Ubuntu 20.04. Xvfb is a powerful tool that allows you to run graphical applications without the need for a physical display. Whether you’re a developer, tester, or simply curious about exploring this virtual display server, this step-by-step guide will help you get started with Xvfb on Ubuntu 20.04 in no time. So let’s dive in and explore the potentials of this mighty tool together!
Introduction to Xvfb and its Features
Xvfb offers an X server that can run on machines without display hardware and physical input device. It simulates a dumb framebuffer using virtual memory. The main purpose of using this server is to test the server.
- Xvfb provides a virtual display server, allowing users to run graphical applications without a physical display or monitor.
- It consumes minimal system resources, making it efficient for resource-constrained environments.
- Xvfb supports flexible display configuration, allowing users to specify screen size, color depth, and other properties.
- It enables remote connections, allowing users to access the virtual display over a network.
- Xvfb uses the X11 protocol to transmit graphical information between the client and server.
- It offers a range of command-line options and configuration parameters for customization.
- Xvfb is widely used for automated testing, continuous integration systems, and server-based rendering.
How to Install Xvfb on Ubuntu 20.04
Follow the steps below to get Xvfb on Ubuntu Linux VPS:
First, you need to install Xvfb with the following command:
sudo apt install xvfb
You’ll need to download a browser. Basically any browser will do the job, here I am downloading Firefox browser on the Ubuntu system!
Install Firefox on Ubuntu 20.04
Now we need to install Firefox. it is installed by default on most systems, but in case you don’t have it, run the following command in the Ubuntu terminal command to install:
sudo apt-get install firefox

Tutorial Use Xvfb on Ubuntu 20.04
Xvfb lets you run browsers/tests in the background without displaying them processing. Use the following syntax to run/test programs silently:
xvfb-run [options] [command]
For example, below I run Firefox using the Xvfb command below, it opens in the background and nothing appears on the screen.
xvfb-run firefox http://google.com
You can use the help with this command. Run the following command to learn more about its use:
xvfb-run --help
How to Test Xvfb on Ubuntu Server
You can run the following command to check the status of the Xvfb process, to see if it’s working properly or not:
ps -ef | grep xvfb
The result will show that it is properly installed on the system, now you can use it without any issues.
Troubleshooting common issues
You might face some issues while installing xvfb on Ubuntu. Here’s list of those issues and a short way to solve them.
Dependency errors during installation
if you faced this issue, run this command:
sudo apt update
to update the package lists Use:
sudo apt --fix-broken install
to fix any broken dependencies. After resolving the dependency errors, attempt to install Xvfb again using:
sudo apt install xvfb
Permission errors when running XVFB
You might face this issue due to insufficient privileges. In that case use the command down below. You have to ensure that the user running Xvfb has proper read and execute permissions on the necessary files and directories.
sudo xvfb-run
Display configuration errors
Verify that the display number specified for Xvfb is available and not already in use. Set the `DISPLAY` environment variable to the correct display number. For example for display number 1:
export DISPLAY=:1
Restart Xvfb after making any configuration changes using
sudo service xvfb restart
Xvfb not starting automatically on system boot
Create a systemd service file for Xvfb using
sudo nano /etc/systemd/system/xvfb.service
Add the necessary configuration to start Xvfb on boot. Enable the Xvfb service using
sudo systemctl enable xvfb.service
Start the Xvfb service using
sudo systemctl start xvfb.service
Check the status of the XVFB service using to ensure it is running properly.
sudo systemctl status xvfb.service
Conclusion
Xvfb, also known as the X virtual frame buffer, lets you run programs silently in the background without displaying the actual processing. It is used to run the tests without opening an unrequited window. In this post, we showed you how you can easily setup this powerful tool on your Ubuntu machine.