博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to install Xvfb (X11 Server) in Linux Server
阅读量:4199 次
发布时间:2019-05-26

本文共 1855 字,大约阅读时间需要 6 分钟。

Xvfb is a virtual frame buffer X11 server that can be installed on linux servers without a monitor and graphics card. It can be customized for multiple displays and screens as well. In this tutorial i will show how to install, setup and configure a display. I am installing the Xvfb (X11 server) on a Centos/ Redhat linux system.

Example:

If you want to capture a screen shot but you have only a linux server running and no graphics card or monitor. To get the output you have to dump the virtual display to a file and then convert to suitable jpg or png graphics with ImageMagick

To Install Xvfb

yum install Xvfb

To intialize the display

Xvfb :1 -screen 0 800x600x24&

This sets the display number 1 and screen 0 to 800×600 resolution with the color depth of 24.

If you get error like

Fatal server error:
Couldn't add screen 0

then most probably you have set the color depth to 32bit which never worked for me. You have to set to 16 bit or 24 bit color for the virtual buffer.

To export the display to X11

export DISPLAY=localhost:1.0

If you get errors like while running Xvfb then you install necessary fonts

Could not init font path element unix/:7100, removing from list!
FreeFontPath: FPE "built-ins" refcount is 2, should be 1; fixing.

yum install xorg-x11-fonts*

It should in most cases fix the problem!

To Run a program in the virtual display.

Use . It gives you an X server to doesn't connect to a physical display.

So, on CentOS, you'd do something like yum install xorg-x11-server-Xvfb.

You can then start it up on display :1 with the command /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x24 &. This will create a screen 1027x768 depth 24 and put the command into the background.

So, the environmental variable you'd specify before launching Firefox would be export DISPLAY=:1, pointing to whatever host is appropriate.

DISPLAY=localhost:1.0 firefox

转载地址:http://giuli.baihongyu.com/

你可能感兴趣的文章
什么是Spring Cloud ?
查看>>
pyqt实现界面化编程
查看>>
qt写DLL文件并调用和出现的问题分析
查看>>
工厂模式(Factory)-设计模式(一)
查看>>
建造者模式(Builder)-设计模式(三)
查看>>
初学Java必备基础知识,编程领域你需要掌握的关键点!
查看>>
阿里五年Java程序员的总结,献给还在迷茫中的你!
查看>>
程序员身上有异味,同事为什么都不会直接告诉他?
查看>>
Java、C、C+ +、PHP、Python分别用来开发什么?一篇文章告诉你!
查看>>
Linux-SHELL常用命令
查看>>
Linux-网络运维基础
查看>>
Verilog编程网站学习——门电路、组合电路、时序电路
查看>>
android——学生信息显示和添加
查看>>
Android——ImageSwitcher轮流显示动画
查看>>
Android——利用手机端的文件存储和SQLite实现一个拍照图片管理系统
查看>>
图像调优1:清晰度相关参数MTF,SFR,MTF50,MTF50P 以及TVL的概念以及换算说明
查看>>
罗永浩欲直播带货,京东说可以帮忙联系
查看>>
B站,正在变成下一个“公众号”?
查看>>
小米启动安心服务月 手机家电产品可免费清洁保养
查看>>
刘作虎:一加新品将全系支持 5G
查看>>