vncserver is a wrapper script for Xvnc, the free X server for VNC (Virtual Network Computing). It provides all capabilities of a standard X server, but does not connect to a display for itself. Instead, Xvnc creates a virtual desktop you can view or control remotely using a VNC viewer.

I was recently asked by a DBA colleague about leveraging VNC Server for installations/upgrades, and if they should incorporate it as part of their infrastructure. Even though VNC Server as a whole is not considered to be secure, DBAs prefer to leverage this technology for Oracle installation and upgrades. DBAs prefer VNC Server technology over the traditional X Windows on the local desktop/laptop, as the Oracle installation/upgrade will proceed significantly faster. DBAs also prefer VNC as network glitches does not cause the install/upgrade to fail. If the network fails during the installation/upgrades, we can simply re-connect to the VNC Server and continue where we left off. If the network fails during the file copies, all we lose is the display and can continue to see the progress. You can install the VNC Server with the yum install command. In the example shown below, we are installing the tightvnc-server RPM on Oracle Linux 6.5:

[oracle@vna01 ~]$ yum install tigervnc-server

Loaded plugins: security
You need to be root to perform this command.
[oracle@vna01 ~]$ su - 
Password: 
[root@vna01 ~]# yum install tigervnc-server
Loaded plugins: security
ol6_UEK_latest                                                                                                    | 1.2 kB     00:00     
ol6_latest                                                                                                        | 1.4 kB     00:00     
ol6_latest/primary                                                                                                |  41 MB     00:35     
ol6_latest                                                                                                                   26208/26208
ol6_u4_base                                                                                                       | 1.4 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-8.el6_5 will be installed
--> Processing Dependency: xorg-x11-xkb-utils for package: tigervnc-server-1.1.0-8.el6_5.x86_64
--> Processing Dependency: xkeyboard-config for package: tigervnc-server-1.1.0-8.el6_5.x86_64
--> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.1.0-8.el6_5.x86_64
--> Processing Dependency: libXdmcp.so.6()(64bit) for package: tigervnc-server-1.1.0-8.el6_5.x86_64
--> Running transaction check
---> Package libXdmcp.x86_64 0:1.1.1-3.el6 will be installed
---> Package xkeyboard-config.noarch 0:2.6-6.0.1.el6 will be installed
---> Package xorg-x11-fonts-misc.noarch 0:7.2-9.1.el6 will be installed
---> Package xorg-x11-xkb-utils.x86_64 0:7.7-4.el6 will be installed
--> Processing Dependency: libxkbfile.so.1()(64bit) for package: xorg-x11-xkb-utils-7.7-4.el6.x86_64
--> Running transaction check
---> Package libxkbfile.x86_64 0:1.0.6-1.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================
 Package                                Arch                      Version                            Repository                     Size
=========================================================================================================================================
Installing:
 tigervnc-server                        x86_64                    1.1.0-8.el6_5                      ol6_latest                    1.1 M
Installing for dependencies:
 libXdmcp                               x86_64                    1.1.1-3.el6                        ol6_latest                     30 k
 libxkbfile                             x86_64                    1.0.6-1.1.el6                      ol6_latest                     74 k
 xkeyboard-config                       noarch                    2.6-6.0.1.el6                      ol6_latest                    710 k
 xorg-x11-fonts-misc                    noarch                    7.2-9.1.el6                        ol6_latest                    5.8 M
 xorg-x11-xkb-utils                     x86_64                    7.7-4.el6                          ol6_latest                     86 k

Transaction Summary
=========================================================================================================================================
Install       6 Package(s)

Total download size: 7.8 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libXdmcp-1.1.1-3.el6.x86_64.rpm                                                                            |  30 kB     00:00     
(2/6): libxkbfile-1.0.6-1.1.el6.x86_64.rpm                                                                        |  74 kB     00:00     
(3/6): tigervnc-server-1.1.0-8.el6_5.x86_64.rpm                                                                   | 1.1 MB     00:00     
(4/6): xkeyboard-config-2.6-6.0.1.el6.noarch.rpm                                                                  | 710 kB     00:00     
(5/6): xorg-x11-fonts-misc-7.2-9.1.el6.noarch.rpm                                                                 | 5.8 MB     00:05     
(6/6): xorg-x11-xkb-utils-7.7-4.el6.x86_64.rpm                                                                    |  86 kB     00:00     
-----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                    956 kB/s | 7.8 MB     00:08     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : xorg-x11-fonts-misc-7.2-9.1.el6.noarch                                                                                1/6 
  Installing : xkeyboard-config-2.6-6.0.1.el6.noarch                                                                                 2/6 
  Installing : libxkbfile-1.0.6-1.1.el6.x86_64                                                                                       3/6 
  Installing : xorg-x11-xkb-utils-7.7-4.el6.x86_64                                                                                   4/6 
  Installing : libXdmcp-1.1.1-3.el6.x86_64                                                                                           5/6 
  Installing : tigervnc-server-1.1.0-8.el6_5.x86_64                                                                                  6/6 
  Verifying  : libXdmcp-1.1.1-3.el6.x86_64                                                                                           1/6 
  Verifying  : xorg-x11-xkb-utils-7.7-4.el6.x86_64                                                                                   2/6 
  Verifying  : libxkbfile-1.0.6-1.1.el6.x86_64                                                                                       3/6 
  Verifying  : xkeyboard-config-2.6-6.0.1.el6.noarch                                                                                 4/6 
  Verifying  : xorg-x11-fonts-misc-7.2-9.1.el6.noarch                                                                                5/6 
  Verifying  : tigervnc-server-1.1.0-8.el6_5.x86_64                                                                                  6/6 

Installed:
  tigervnc-server.x86_64 0:1.1.0-8.el6_5                                                                                                 

Dependency Installed:
  libXdmcp.x86_64 0:1.1.1-3.el6                 libxkbfile.x86_64 0:1.0.6-1.1.el6          xkeyboard-config.noarch 0:2.6-6.0.1.el6     
  xorg-x11-fonts-misc.noarch 0:7.2-9.1.el6      xorg-x11-xkb-utils.x86_64 0:7.7-4.el6     

Complete!

Now that the VNC Server is installed, let’s configure the VNC Server to auto start a reboot. It is very important for me to note that we do NOT want to do this for the production database servers. We configure the VNC Server to auto-start by modifying the /etc/sysconfig/vncservers file and add the following 2 lines for oracle:

VNCSERVERS="3:oracle"
VNCSERVERARGS[3]="-geometry 1280x1024"

To enable the vncserver service to autostart, we have to execute the chkconfig command:
chkconfig vncserver on

Before we start the vncserver, we need to establish a VNC password for the oracle account. Switch user to oracle and execute the vncpasswd command:

# su - oracle
$ vncpasswd oracle
Password:
Verify:

Log back in as the root account and start the vncserver with the “service vncserver start” command.

[root@vna01 ~]# service vncserver start
Starting VNC server: 3:oracle xauth:  creating new authority file /home/oracle/.Xauthority

New 'vna01:3 (oracle)' desktop is vna01:3

Creating default startup script /home/oracle/.vnc/xstartup
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/vna01:3.log

                                                           [  OK  ]

With any VNC Viewer, you should be able to access the VNC Server. Since I am on a Mac, I am using a freeware/shareware called Chicken of the VNC. Notice that I am leveraging :3 as my display port since I setup the “VNCSERVERS=”3:oracle” in my /etc/sysconfig/vncservers file.

2014 10 04 11 09 02

To demonstrate how we can maintain the vncserver as the oracle user, we are going to kill the currently running vncserver process and re-start it. To kill the vncserver, we pass the -kill parameter to the vncserver executable. We also provide the display number to kill parameter as shown in the example below:

[oracle@vna01 ~]$ ps -ef |grep vnc
oracle    5954     1  0 11:06 ?        00:00:00 /usr/bin/Xvnc :3 -desktop vna01:3 (oracle) -auth /home/oracle/.Xauthority -geometry 1280x1024 -rfbwait 30000 -rfbauth /home/oracle/.vnc/passwd -rfbport 5903 -fp catalogue:/etc/X11/fontpath.d -pn
oracle    5960     1  0 11:06 ?        00:00:00 vncconfig -iconic
oracle    5999  5972  0 11:10 pts/0    00:00:00 grep vnc
[oracle@vna01 ~]$ vncserver ^C
[oracle@vna01 ~]$ man vncserver
[oracle@vna01 ~]$ vncserver -kill :3
Killing Xvnc process ID 5954

We can also start a vncserver manually as the oracle user account. To start a vncserver process on display port 3, we pass the :3 parameter:

[oracle@vna01 ~]$ vncserver :3

New 'vna01:3 (oracle)' desktop is vna01:3

Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/vna01:3.log

When we executed the vncpasswd command, a subdirectory was created under the $HOME directory called .vnc. In this subdirectory, there are several files. The passwd file is the encrypted password for the VNC Server.

[oracle@vna01 .vnc]$ ls -ltr
total 16
-rw------- 1 oracle oinstall    8 Oct  4 11:06 passwd
-rwxr-xr-x 1 oracle oinstall  654 Oct  4 11:06 xstartup
-rw-r--r-- 1 oracle oinstall    5 Oct  4 11:13 vna01:3.pid
-rw-r--r-- 1 oracle oinstall 1531 Oct  4 11:13 vna01:3.log

The xstartup file contains all the parameters for the vncserver process.

When to leverage VNC Server

We strongly discourage installing VNC Server on any production servers. Nonetheless, for Oracle installations and upgrades, we often need access to a X Server to set our GUI display to. We can leverage a remote VNC Server on a needed basis. As a temporary solution, we can start a vncserverprocess on another server when we need it and kill the processes when we are done with the install/upgrade. To set the display from the production database server to the remote VNC server, we simply set the DISPLAY parameter to the hostname:DISPLAY port. In our example, the name of our VNC Server was on vna01 and we are listening on DISPLAY port 3 so we will setup our DISPLAY parameter to be:


export DISPLAY=vna01.viscosityna.com:3

Posted in Linux
Share this post, let the world know

Comments are closed