Wednesday, 1 February 2012

Create VNC display in Solaris 10

I have been using a script for a while to configure VNC server displays for Solaris Express (Nevada) and I just found out that the same script works on Solaris 10 5/08 (Solaris 10 Update 5) as it includes Xvnc also.
I always do a  full install of Solaris. If you don't, then maybe Xvnc will not be installed on your system. You can easily check:
# pkginfo | grep  xvnc
system      SUNWxvnc                         X11/VNC server
You run the below script once after OS installation is complete. It sets up two VNC displays and you connect to them with a  VNC client as <hostname>:1 and <hostname>:2 . The second display is shared.
====================== Script ======================================================================
# Run this script once after OS installation is completed.
# This has been tested with Solaris 10 5/08 and Solaris Express (Nevada) b87 onwards

#add vnc display 1
svccfg -s application/x11/x11-server add display1
svccfg -s application/x11/x11-server:display1 addpg options application
svccfg -s application/x11/x11-server:display1 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display1 addpropvalue options/server_args astring: '"SecurityTypes=None"'

#add vnc display 2, which is shared
svccfg -s application/x11/x11-server add display2
svccfg -s application/x11/x11-server:display2 addpg options application
svccfg -s application/x11/x11-server:display2 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"SecurityTypes=None"'
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"-alwaysshared"'

# Configure dtlogin to start it
if [ ! -d /etc/dt/config ] ; then
        mkdir -p /etc/dt/config
if [ ! -f /etc/dt/config/Xservers ] ; then
        cp /usr/dt/config/Xservers /etc/dt/config/Xservers

echo "   :1   Local local_uid@none root /usr/X11/bin/Xserver :1" >> /etc/dt/config/Xservers
echo "   :2   Local local_uid@none root /usr/X11/bin/Xserver :2" >> /etc/dt/config/Xservers

pkill -HUP dtlogin
====================== Script ======================================================================
The displays persist when you disconnect the VNC client, so you can come back to a session at  later time and all the windows and applications will be as you left them. Any jobs you kicked off will have continued to run.
You can get VNC client software from There is a Free Edition and an enhanced Personal Edition for which you need a license.
If you have an older release of Solaris 10 than 5/08 then take a look at my earlier blog entry about how to configure VNC. 

No comments: