Linux has always been a favorite for programmers and code testers. The platform allows coders enough freedom to let them carry out their tasks brilliantly. And one such task is confirming the works of a well-written code. However, doing such tests also requires a display for subsequent results.
But what if you can process such jobs in the background without engaging with the output device? That is what an XVFB hopes to offer. Today, we will demonstrate the installation of XVFB on any Linux device.
What is XVFB?
XVFB stands for X-Virtual Framebuffer. It is a display server that implements the X11 DS (display server) protocol. However, unlike other display servers, the X11 XVFB is known for handling all graphical operations in the background using virtual memory.
It means that the display server doesn’t show any screen output. It works like any other display server, be it receiving requests, acting on them, or even sending reports and errors.
However, the subsequent output is hidden. But it doesn’t mean there is none. There are results, but not shown in the graphical format. Hence, the XVFB doesn’t need any graphics card/adapter, screen, or input device. Only a network layer is needed for communication.
XVFB was initially used for server testing. Hence, the frame buffer code for any depth would get calculated with the X server. And that too without the need for any actual hardware. Today, there are many uses for XVFB, from testing clients to performing batch processing, and even load testing.
Prerequisites
Before installing XVFB, kindly ensure the following:
- A Linux-powered device.
- Recent configurations, such as at least 2 GB RAM
- And a working internet connection.
Install XVFB on Ubuntu
The XVFB doesn’t have a GUI. Thus, the installation will be done using the Command Terminal. Follow the steps shown below:
Step 1. First, run the command terminal by pressing Ctrl + Alt + T
Step 2. Update the system repositories.
sudo apt update
Step 3. Now, install XVFB.
sudo apt install xvfb
Step 4. After that, install web browsers. It is a necessary process, but the user is free to download any web browser. For this example, we are downloading Firefox.
sudo apt-get install firefox
Step 5. Then, it’s time to test the XVFB. Enter the following command to test it.
ps -ef | grep xvfb
If the result shows the installation to be proper, we can proceed.
Step 6. Finally, we can use XVFB to run our browser as an example. The required command is:
xvfb-run firefox http://google.com
Step 7. In the end, note down the following command for any help with XVFB
xvfb-run --help
Install XVFB on CentOS, RHEL
Users can also use the YUM or DNF to install XVFB. The steps are:
Step 1. Run the command terminal.
Step 2. Update the yum database using dnf.
sudo dnf makecache --refresh
Step3. After that, install XVFB on your Cent OS or RHEL
sudo yum -y install xorg-x11-server-Xvfb
FAQ
XVFB is deprecated and is no longer being maintained. Hence, the only reason you should use it is when you absolutely need it to work with your projects or system.