Configuring VNC

The Oracle Universal Installer requires an X environment to run on Linux servers. Several products are available to support this environment; for the last couple of years I have been using VNC. In Oracle 11.2. and above the configuration of VNC is slightly more complex if you follow the recommendation to install Grid Infrastructure under a different operating system user (grid) to the Oracle RAC software (typically oracle).

VNC is a free client/server product in which a VNC server session runs on the server and a VNC Viewer runs on the client.

On the server, VNC is supplied with the operating system in Red Hat and Oracle Enterprise Linux distributions. For OEL5R5 the VNC server RPM is vnc-server-4.1.2-14.el5_3.1. In Linux, VNC is implemented as a service. You can check if it is currently installed using:

[root@server14]# rpm -q vnc-server

If the package is not installed then install it from the Linux distribution. For example:

[root@server14]# rpm -ivh vnc-server-4.1.2-14.el5_3.1.rpm

Check if the vncserver service is currently running. For example:

[root@server14]# service vncserver status
Xvnc is stopped

If the vncserver service is not currently running then it can be started using:

[root@server14]# service vncserver start

If you receive the following message then configuration of VNC on the server is required.

Starting VNC server: no displays configured            [ OK ]

To configure VNC on the server, login as root and add the following lines to /etc/sysconfig/vncservers

VNCSERVERS="1:grid 2:oracle
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"

Set the geometry to reflect the display size available on the client. Note that the server number (in this case 1) must be specified when connecting from the client. For example server14:1

Login as the grid user and run vncpasswd:

[grid@server14]$ vncpasswd
Password: <enter password>
Verify: <enter password again>

Note that the password must be a minimum of six characters in length

Login as the oracle user and run vncpasswd:

[oracle@server14]$ vncpasswd
Password: <enter password>
Verify: <enter password again>

Login as root and start the VNC service:

[root@server14]# service vncserver start
Starting VNC server: 1: grid xauth: creating new authority file /home/grid/.XAuthority
New 'server14.example.com:1 (grid)' desktop is server14.example.com:1
Creating default startup script /home/grid/.vnc/xstartup
Starting applications specified in /home/grid/.vnc/xstartup
Log file is /home/grid/.vnc/london1.example.com:1.log

Starting VNC server: 2: oracle xauth: creating new authority file /home/oracle/.XAuthority

New 'server14.example.com:2 (oracle)' desktop is server14.example.com:2

Creating default startup script /home/oracle/.vnc/xstartup\nStarting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/server14.example.com:2.log

Edit /home/grid/.vnc/xstartup and uncomment the following two lines:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Edit /home/oracle/.vnc/xstartup and uncomment the following two lines:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Login as root and restart the vncserver service:

[root@server14]# service vncserver restart

The vncserver service can be permanently enabled using:

[root@server14]# chkconfig vncserver on

The above command will start vncserver at run levels 2,3,4 and 5

For the client, VNC can be downloaded from a number of sources such as http://www.realvnc.com. At the time of this writing the current version was 4.1.3. Versions are available for Windows, Linux and several other UNIX-based operating systems.

For example for Windows based clients VNC can be downloaded as either a ZIP file or an executable file. In this example the zip file was called vnc-4_1_3-x86_win32.zip and contained a single executable file called vnc-4_1_3-x86_win32.exe. This executable runs the VNC Setup Wizard which allows you to install the VNC server, viewer or both.

In this example VNC server has been added to the Windows menus

Start > Programs > RealVNC > VNC Viewer 4 > Run VNC Viewer

Enter the server name when prompted e.g. server14:1 for the grid user or server14:2 for the oracle user. Enter the vnc password for the grid/oracle user.