Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing and Configuring xvfb

Tags:

I'm trying to find a Ubuntu operating system, version of xorg, and version of xvfb that are compatible. Can anyone help me with directions to install xvfb without getting a hang on Initializing build-in extension GLX

So far I've tried the following

Ubuntu 13 Server(No graphics card) sudo apt-get install xorg  sudo apt-get install xvfb sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic 

I run the command xvfb :10 and it hangs on

Initializing build-in extension GLX 

Are there specific versions I could download that will work or a operating system that would be compatible?

like image 522
kevinn2065 Avatar asked Feb 09 '14 22:02

kevinn2065


People also ask

What is xvfb process?

Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.

What is xvfb command in Linux?

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.


2 Answers

Install Xvfb or Xephyr or Xvnc. Also install pyvirtualdisplay python module. This is for Ubuntu 14.04 and tested on 16.04 as well.

sudo apt-get install python-pip sudo apt-get install xvfb xserver-xephyr vnc4server sudo pip install pyvirtualdisplay # optional sudo apt-get install python-pil scrot sudo pip install pyscreenshot 

Now you can start Xvfb from your python script. It will start Xvfb when your script will be executed. Add the following lines to your code.

from pyvirtualdisplay import Display display = Display(visible=0, size=(1366, 768)) display.start() 

Here is the example code.

from pyvirtualdisplay import Display from selenium import webdriver  display = Display(visible=0, size=(1366, 768)) display.start() browser = webdriver.Firefox() browser.get('http://www.google.com') print browser.title browser.quit()  display.stop() 
like image 111
Rafayet Ullah Avatar answered Sep 19 '22 21:09

Rafayet Ullah


Here is what I do:

apt install xvfb

Xvfb&

xvfb-run someprogram

Source: http://realtechtalk.com/using_Xvfb_on_virtual_remote_ssh_server_to_have_X_graphical_programs_work-2287-articles

like image 25
Areeb Soo Yasir Avatar answered Sep 21 '22 21:09

Areeb Soo Yasir