Ubuntu Fluxbox GUI with x11vnc and Xvfb

前端之家收集整理的这篇文章主要介绍了Ubuntu Fluxbox GUI with x11vnc and Xvfb前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

http://www.richud.com/wiki/Ubuntu_FluxBox_GUI_with_x11vnc_and_Xvfb

http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/

https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin



Contents

FluxBox GUI,via VNC (5900) and Xvfb

This will let you remotely access your machine to a FluxBox GUI,via VNC (5900) and Xvfb completely separately to your 'normal' desktop.

Install the bits

$ sudo apt-get install x11vnc xvfb fluxBox


One liner

  • -create makes it start Xvfb
  • X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 makes it goto the created Xvfb session (Display:1 rather than:0 which will be normal desktop)
  • FD_PROG=/usr/bin/fluxBox makes it fire up FluxBox (Ubuntu's one,should have background Ubuntu logo)
  • X11VNC_CREATE_GEOM=${1:-1024x768x16} sets screen to 16bit colour 1024x768
  • -gone cleans up when it exits as otherwise Xvfb is left behind (killing xvfb also kills fluxBox)
$ x11vnc -create -env FD_PROG=/usr/bin/fluxBox \
	-env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 \
        -env X11VNC_CREATE_GEOM=${1:-1024x768x16} \
        -gone 'killall Xvfb' \
        -bg -nopw


need -auth /var/run/lightdm/root/:0?

Doing it separately

taken from http://en.wikipedia.org/wiki/Xvfb

export DISPLAY=:1
Xvfb:1 -screen 0 1024x768x16 &
fluxBox &
x11vnc -display:1 -bg -nopw -xkb

Examples

Scenario,access your work machine by creating a reverse ssh tunnel (other pages with more details)

Autossh keeps a ssh tunnel open back from your firewalled work to you homeaddress,port 27002 is an arbitary number for monitoring,basically anything that isnt used for something else.

$ autossh -f -M27002 -q -N -o stricthostkeychecking=no -R 22222:localhost:22 -R 5900:localhost:5900 user@homeaddress

This will sit running on your work pc trying to connect to your home every 300 seconds on port 22 (you will need to map incoming TCP port 22 on your home router to your PC behind it)If you look in /var/log/auth.log you should see your work pc connect. (you will need to have setup with authorized_keys rather than password access for ssh,see other pages)

Once it connects you can now SSH to 127.0.0.1 port 22222 on your home pc which will connect back through this tunnnel to your work pc into a normal terminal.Run the above command to start x11vnc.Now connecting to 127.0.0.1 (on port 5900) on home pc should connect you through to a FluxBox session on the work pc! (which is invisible to anyone looking on it as it is running in a virtual framebuffer (Xvfb).

Using vino-server

If you want a direct connection to the 'real' desktop you can either use x11vnc without setting anything,or use built in vino-server (aka 'Vino' aka 'Desktop Sharing'). If you are using unity and broadband the experience will be pretty dire except using the lowest settings,which is still pretty aweful.In Precise 12.04 (and 11.10?) vino settings are set in dconf NOT in ~/.gconf/desktop/gnome/remote_access/%gconf.xml

dconf-editor is needed to edit via GUI,gesettings edits via command line

  • enable
  • stop user to confirm (i.e. prompt) [this is vital otherwise you end up connecting to a black screen,which many threads will tell you the incorrect solution for is to replace compiz with Metacity etc.]
  • turn off authentication (as going to listen on local interface only,any connection via SSH)
  • listens on local only [obv. dont set this is you are using on a LAN,and probably set a password]

e.g.

$ export DISPLAY=:0
$ gsettings set org.gnome.Vino enabled true
$ gsettings set org.gnome.Vino prompt-enabled false
$ gsettings set org.gnome.Vino authentication-methods "['none']"
$ gsettings set org.gnome.Vino network-interface lo

These settings take place instantly,you can see this by running "netstat -an --tcp --program",you will see 0.0.0.0:5900 to begin with (default) listen on all interfaces,as soon as you set interface to lo,you should see this change

tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      12590/vino-server
#change to
tcp        0      0 127.0.0.1:5900          0.0.0.0:*               LISTEN      12590/vino-server

If it doesn't start you can do it via this,the ampersand with background it.

/usr/lib/vino/vino-server --sm-disable &

So my Vino settings look like;

$ gsettings list-recursively org.gnome.Vino
org.gnome.Vino alternative-port uint16 5900
org.gnome.Vino authentication-methods ['vnc']
org.gnome.Vino disable-background false
org.gnome.Vino disable-xdamage false
org.gnome.Vino enabled true
org.gnome.Vino icon-visibility 'client'
org.gnome.Vino lock-screen-on-disconnect false
org.gnome.Vino mailto ''
org.gnome.Vino network-interface 'lo'
org.gnome.Vino notify-on-connect true
org.gnome.Vino prompt-enabled false
org.gnome.Vino require-encryption false
org.gnome.Vino use-alternative-port false
org.gnome.Vino use-upnp false
org.gnome.Vino view-only false
org.gnome.Vino vnc-password 'keyring'


  • org.gnome.Vino authentication-methods ['vnc'] / org.gnome.Vino vnc-password 'fgWdfggG=',where it is base64 encoded. [Setting a connection password in vino-preferences (or Desktop Sharing,which is same thing) does this]
  • org.gnome.Vino authentication-methods ['vnc'] / org.gnome.Vino authentication-methods ['none'] = makes it use your normal keyring (GUI now called seahorse) for storing password
  • org.gnome.Vino authentication-methods ['none'],no additional password
  • Note vino-passwd doesnt seem to set anything anywhere -will look into this more,strace seems to show its writing to org.freedesktop.Secr,but dont understand more yet. WIP.

x11vnc

As a pure VNC server (better than vino).

sudo x11vnc -nc -localhost -once -nopw -auth /var/lib/gdm/:0.Xauth -display:0

Once running you can connect securely via an SSH tunnel with Remmina for example,enable ssh tunnel and local loopback. (as its listening on lo remotely)

Plugin Information

Plugin ID

xvfb

Changes

In Latest Release
Since Latest Release

Latest Release
Latest Release Date
required Core
Dependencies

1.1.3 (archives)
Mar 20,2016
1.609.1

Source Code
Issue Tracking
Pull Requests
Maintainer(s)

GitHub
Open Issues
Pull Requests
Zoran Regvart (id: zregvart)

Usage

Installations

2016-May 4382
2016-Jun 4610
2016-Jul 4530
2016-Aug 4751
2016-Sep 4871
2016-Oct 4858
2016-Nov 4882
2016-Dec 4851
2017-Jan 5055
2017-Feb 5169
2017-Mar 5360
2017-Apr 5218

What is it?

Lets you controlXvfb virtual frame buffer X11 server with each build. It starts Xvfb before the build starts,and stops it with the build. This is very useful if your build requires X11 access,for instance runs tests that require GUI.

New feature in version 1.1.0 - Jenkins Pipeline support

With 1.1.0 Pipeline support has landed,you can now use Xvfb to wrap other pipeline steps:

node {
wrap([$ class : 'Xvfb' ]) {
... your steps here
}
}

New feature in version 1.0.16 - Parallel build mode

Use I’m running this job in parallel on same node when running multiple slaves (Jenkins nodes) on the same machine to prevent collisions when jobs are run on same-numbered executors.

New feature in version 1.0.11 - Labels

Use Start only on nodes labeled option for multi platform builds.

New feature in version 1.0.9 - auto display name (on newer Xvfb versions)

Use Let Xvfb choose display name option with Xvfb that supports displayfd option to choose the display number automatically by Xvfb.

Usage

The plugin starts and stops the Xvfb virtual framebuffer X11 server so your jobs can use X11 displays in headless environments such as servers,or when dedicated X11 display is required for each job.

Start by going to Manage Jenkins / Global Tool Configurationon Jenkins version 2.0 orManage Jenkins/Configure Systemon earlier version and setup your Xvfb installation. You need to give it a arbitrary name like default Xvfb and directory in which the Xvfb executable is located like /usr/X11R6/bin. Unfortunately there is no support for automatic installation of Xvfb. As of version 1.1.0 you can define a single Xvfb tool installation or have a installation named "default" and the jobs are going to run even if you don't define what installation to use in the job configuration.

Typically you would use the defaults,which are that display numbers,a unique number that is used to identify each X11 display (you might see them shown as :0,:1 or such),are based on the current Jenkins executor number (the number you see next to the running job in the Build Executor Status Box). This is fine if display numbers corresponding to the executor numbers are available for Jenkins to use. If they're not you have several options:

  • use a fixed display number (Xvfb specific display name) by which you guarantee that the specified display number is reserved for the specified Jenkins job
  • use display numbers based on executor numbers but offset by some number (Xvfb display name offset) by which you reserve a range of display numbers for the specified Jenkins job,for instance if you use offset of 100,display names will be 100 and greater,up to the number of executors on a particular Jenkins executor (i.e. slave or master depending on where the job is run)
  • leave the choice of display number to Xvfb (Let Xvfb choose display name) – if your Xvfb version supports it,by which Xvfb chooses a free display number on its own

Project Configuration

On the job configuration page,enable the "Start Xvfb before the build,and shut it down after." under the Build Environment.

If you want to customize defaults click on Advanced... button.

  • Xvfb installation lets you choose Xvfb installation to use,these are configured by the Jenkins administrator in the Tools section of Jenkins configuration. By default the first defined installation is used.
  • Let Xvfb choose display name Uses the -displayfd option of Xvfb by which it chooses its own display name by scanning for an available one. This option requires a recent version of xserver,check your installation for support. Useful if you do not want to manage display number ranges but have the first free display number be used.
  • Xvfb specific display name lets you customize what displayname should be created,enter a number here and that number prefixed by : will be the displayname (e.g. :1). If none is given display name is based upon Jenkins executor number increased by 1,or the configurable Xvfb display name offset.
  • I’m running this job in parallel on same node - if you have multiple slaves on the same machine,the build number will be generated based on the ordinal of the machine multiplied by 100 plus the executor number and any offset configured. Be careful Xvfb will not work with this enabled if you're running more than 595 nodes and 35 executors per node.
  • Start only on nodes labeled lets you specify via label expressions on what node(s) to start Xvfb.
  • Timeout in secondslets you specify the number of seconds before letting the build progress. Since Xvfb is started in background,certain builds might fail because Xvfb was not started quick enough,with this the build is paused the for specified seconds to let Xvfb startup. The default is not to pause the build.
  • Xvfb screen changes the screen resolution and pixel depth,it needs to be in WxHxD format (i.e. 1600x1200x24). The default is1024x768x24.
  • Xvfb display name offsetlets you specify a offset i.e. a number that will be added to the job's executor number that will form the display name used. This is handy if you run other X servers (Xvfb,Xvnc or similar) in order to ensure that display numbers do not overlap.
  • Xvfb additional optionslets you specify any additional Xvfb command line options you might need.
  • Log Xvfb output redirects output of Xvfb into job log,useful if you need to troubleshoot Xvfb starting/stopping.
  • Shutdown Xvfb with whole job,not just with the main build action keeps Xvfb running for post build steps.

Jenkins configuration

Jenkins administrator needs to define the Xvfb tool installation.

The directory in which to find Xvfb executable can be left blank,then PATH is searched to find the executable.

Version History

Version 1.1.3 (Mar 20,2015)

JENKINS-32039 "screen" default does not work
JENKINS-33206 Xvfb plugin doesn't remember "Log Xvfb output" set via the configuration page
JENKINS-33288 Xvfb error does not fail build

Thanks to Mark Leaky,Nathan Smith and Francis De Brabandere for reporting issues!

Version 1.1.2 (Dec 10,2015)

JENKINS-32005 Xfvb plugin doesn't remember displayname set via the configuration page

Thanks to Adriaan Wisse for reporting the issue!

Version 1.1.1 (Dec 5,2015)

PULL#8 Screen name was not being set from the configuration.

Thanks to Daniel Borges for the pull request!

Version 1.1.0 (Nov 24,2015)

Added support for the Pipeline Plugin

Version 1.0.16 (Feb 8,2015)

JENKINS-26848 Does not actually randomize DISPLAY

Thanks to Jo Shields for reporting and testing!

Version 1.0.15 (Jan 20,2015)

JENKINS-26504 Cannot run low numbered builds with xvfb in Jenkins 1.597
JENKINS-26505 java.lang.IllegalArgumentException: Prefix string too short org.jenkinsci.plugins.xvfb.XvfbBuildWrapper.launchXvfb(XvfbBuildWrapper.java:484) duplicate

Thanks to Jonathan Price and mturra for reporting the issue!

Version 1.0.13 (Oct 1,2014)

Prevent NPE when NullConverter registered pull request by Aleksandr Zhuikov

Thanks to Aleksandr Zhuikov for the pull request!

Version 1.0.12 (Jun 2,2014) - bug-fix release

  • JENKINS-23267 NullPointerException in XvfbBuildWrapper.setUp when configured without node label restrictions

Thanks to Alexander Clausen,Jarosław Strzelecki & elygre for reporting and suggesting fix.

Version 1.0.11 (Jun 1,2014)

Thanks to cowwoc for reporting and testing!

Version 1.0.10 (Apr 23,2014)

  • JENKINS-22719 Xvfb plugin does not start before release plugin
  • Zombie slaying on Jenkins master failure

Thanks to Zoltan Nagy and Dmitry Katsubo for reporting and testing!

Version 1.0.9 (Mar 5,2014)

  • JENKINS-20758 Xvfb processes remain after slave disconnect
  • JENKINS-19950 DISPLAY variable is not overwritten when it already exists
  • JENKINS-21548 Xvfb failure does not fail build
  • New feature that lets Xvfb to pick the display name

Thanks to Marc Günther,Richard Cross and Jonathan Rogers for reporting and beta testing!

Version 1.0.8 (Jun 29,2013)

  • JENKINS-18094 Xvfb plugin doesn't write any error message in build log

Thanks to Aleksey Alekseev for reporting and testing!

Version 1.0.7 (Dec 9,2012)

Thanks to Yves Langisch for reporting the feature request!

Version 1.0.6 (Nov 5,2012)

  • JENKINS-15638 Xvfb 'display name offset' defaults to 0,not 1 as described,if unset

Thanks to Fredrik Vihlborg for re-reporting issues!

Version 1.0.5 (Oct 30,if unset

Thanks to Fredrik Vihlborg for reporting issues!

Version 1.0.4 (Oct 24,2012)

  • JENKINS-14483 Remaining Xvfb processes in matrix jobs
  • pull request #2 Make sure the random display name is always more than 0.
  • JENKINS-15608 Xvfb 'specific displayname' selects a random display between 0..100,not 1..100.

Thanks to Thorsten Kahler for reporting the issue and exemplary patience in testing, JeroenVanHab for the pull request and Fredrik Vihlborg for reporting the issue!

Version 1.0.3 (Sep 15,2012)

Thanks to Brian Sipos and Daniel Piorkowski for reporting issues!

Version 1.0.2 (Mar 12,2012)

  • Field to add additional options to Xvfb command line (JENKINS-13046)

Version 1.0.1 (Jan 29,2012)

  • Initial release
Gefällt mir

猜你在找的Ubuntu相关文章