Saturday, January 31, 2009

VNC on Solaris

As Good A Place As Any


Tim Thomas's Blog






Script to Configure VNC Server in Solaris 10 5/08 and Solaris Express (Nevada)
07/09/08 06:07

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 :1 and :2 . The second display is shared.



#!/bin/sh
#
# config_Xvnc_s10+snv.sh
#
# 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
fi
if [ ! -f /etc/dt/config/Xservers ] ; then
cp /usr/dt/config/Xservers /etc/dt/config/Xservers
fi

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



#End



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 http://www.realvnc.com. There is a Free Edition and an enhanced Personal Edition for which you need a license.

No comments: