1.下载xvfb的rpm包进行安装

    下载rpm安装包:http://rhn.redhat.com/errata/RHBA-2013-0083.html

    安装rpm包:#rpm -ivh –nodeps –force xxx.rpm

    启动:#Xvfb -ac :7 -screen 0 1280x1024x8

     #export DISPLAY=:7

    测试:#firefox http://www.investopedia.com

2.创建快捷启动

   创建快捷启动服务:

   #cd /etc/init.d

   #touch xvfbd

   #vim xvfbd

#!/bin/bash
#
# /etc/rc.d/init.d/xvfbd
#
# chkconfig: 345 95 28
# description: Starts/Stops X Virtual Framebuffer server
# processname: Xvfb
#
 
. /etc/init.d/functions
 
[ "${NETWORKING}" = "no" ] && exit 0
 
PROG="Xvfb"
PROG_OPTIONS=":7 -ac -screen 0 1024x768x24"
PROG_OUTPUT="/tmp/Xvfb.out"
 
case "$1" inr
    start)
        echo -n "Starting : X Virtual Frame Buffer "
        $PROG $PROG_OPTIONS>>$PROG_OUTPUT 2>&1 &
        disown -ar
        /bin/usleep 500000
        status Xvfb & >/dev/null && echo_success || echo_failure
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            /bin/touch /var/lock/subsys/Xvfb
            /sbin/pidof -o  %PPID -x Xvfb > /var/run/Xvfb.pid
        fi
        echo
        ;;
    stop)
        echo -n "Shutting down : X Virtual Frame Buffer"
        killproc $PROG
        RETVAL=$?
        [ $RETVAL -eq 0 ] && /bin/rm -f /var/lock/subsys/Xvfb /var/run/Xvfb.pid
        echo
        ;;
    restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
    status)
        status Xvfb
        RETVAL=$?
        ;;
    *)
     echo $"Usage: $0 (start|stop|restart|reload|status)"
     exit 1
esac
 
exit $RETVAL

  启动服务:

  #chmod +x /etc/init.d/xvfbd

  #chkconfig xvfbd on

  #service xvfbd start

3.使用xvfb进行测试:

   使用xvfb进行测试,需要设置:

   #xport DISPLAY=:7

   测试:#firefox http://www.investopedia.com