Connect to VNCServer on Red Hat Enterprise Linux

tightvnclogo Virtual Network Computing (VNC) is remote control software to allow computers interact with one another as a server and client. It is developed to ease the administration of remote machines without using the console. For Windows users, there may be a a familiar feel similar to that of Windows Terminal Services (RDP). VNCServer is standard on a Red Hat Enterprise Linux (RHEL) install. To connect to the VNCServer service on the RHEL box, Windows users among other builds, may use an application called TightVNC. This guide will get the VNCServer service configured so that TightVNC will be able to access the RHEL installation.

Prerequisities

  • root privledges
  • TightVNC client software

Setup VNC Server
Start the vncserver serivce, if the service is not already running. Then set a password to access the VNC desktop; this is done the first time. It may be changed at anytime with the vncpasswd command. Then activate the VNC desktop with the vncserver command. A connection may be made either with the computer name or IP address.

[root@myrhelserver etc]# service vncserver start
Starting VNC server: [ OK ]
[root@myrhelserver etc]#
[root@myrhelserver etc]# vncpasswd
Password:
Verify:
[root@myrhelserver etc]#
[root@myrhelserver etc]# vncserver

New 'myrhelserver:1 (root)' desktop is myrhelserver:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/myrhelserver:1.log

Connect with TightVNC
This guide assumes that TightVNC is already installed.

  • Type in the VNC server name or IP and the connection number (could be 1 or in my case 2, or so on)
    tvnc02
  • After successfully connecting, the screen will most likely be greyed with a terminal screen.

To change this to a windows like GUI pending on the installation, KDE or Gnome there are a few more steps.

  • Using terminal access and logged in as root into the root directory type
    [root@myserver ~]# ls -a
  • Change to the hidden directory .vnc
    [root@myserver ~]# cd .vnc
  • Check for the existance of xstartup
    [root@myserver ~]# ls
  • If it is there, and it should be, edit the xstartup file to match this one
]#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &

Note: The command startx will launch Gnome and the command startkde will launch the KDE desktop upon login via VNCserver.

The result
Relaunch TightVNC and access the KDE desktop of this Red Hat Enterprise Edition 5.2 installation.

tvnc03

source