Xvfb, CentOS7, gdm, and x11vnc

Yep, the title says it all. This is based on the previous post regarding RHEL6, and it is pure geekdom.

Sometimes it is nice to have not only one X display start at boot, but two! My choice is to have the first display tied to hardware, and the second be software based. The latter can be accomplished with VNC, but it has been my preference to use the X Virtual Frame Buffer package (Xvfb), and let x11vnc do the translation to the VNC protocol.

CentOS makes it east to fetch the Xvfb package, which is not included in the DVD ISO image. You will need these two packages, from:

http://mirror.centos.org/centos/7/updates/x86_64/Packages/

The release versions may vary, but you get the idea:

xorg-x11-server-common-1.19.3-11.el7_4.1.x86_64.rpm
xorg-x11-server-Xvfb-1.19.3-11.el7_4.1.x86_64.rpm

The /etc/gdm/custom.conf file is pretty much empty. Change is and make sure you have these options in it:

# GDM configuration storage

[daemon]

[security]
AllowRemoteRoot=true
DisallowTCP=false

[xdmcp]
Enable=true
MaxSessions=30

[greeter]

[chooser]

[debug]

Then create the file /etc/systemd/system/Xvfb.service:

[Unit]
Description=X Virtual Frame Buffer Service
After=network.target

[Service]
ExecStart=/usr/bin/Xvfb :1 -screen 0 1824x1004x24 -pixdepths 24 -query localhost

[Install]
WantedBy=multi-user.target

Ensure your changes take hold:

chmod +x /etc/systemd/system/Xvfb.service
systemctl enable Xvfb.service
systemctl start Xvfb.service

To hook it to VNC, add your service in /etc/services:

vncserver       5901/tcp

Add your /etc/xinetd.d/vncserver file:

service vncserver
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /path/to/x11vnc/binary
        server_args     = -inetd -rfbport 5901 -forever -shared -q -skip_lockkeys -o /dev/null -display :1 -buttonmap 12345-123:Prior::Next: -buttonmap 12345-123:Up+Up+Up::Down+Down+Down:
        log_on_failure  += USERID
}

And restart xinetd. Voila! You now have GDM running, available via VNC. Cheers.

Thank you to the author of this web page, for reference:

https://gist.github.com/ypandit/f4fe751bcbf3ee6a32ca

Comments are closed.