Setup VNC Server on RHEL 6

Service Setup

yum install tigervnc-server
cd /etc/sysconfig
cp -p vncserver vncserver.old
vi vncserver

I add the following lines to the config file /etc/sysconfig/vncservers.
**** careful with the quotes – they maybe Windows style… if you are copying into Linux etc.

VNCSERVERS=”1:root 2:oracle”
VNCSERVERARGS[1]=”-geometry 1440×900″
VNCSERVERARGS[2]=”-geometry 1440×900″
chkconfig –list
chkconfig vncserver on
service vncserver start

Because I’m behind a few firewalls I can relatively safely turn off the RHEL firewalls by – depending on your firewall settings – the holes for the ports may already be drilled and turning off the firewall may not be necessary – or you can open the correct ports yourself if necessary (not shown):

service iptables stop
service ip6tables stop
chkconfig –list | grep -i tables
chkconfig vncserver on
chkconfig –list vncserver

Individual User Setup (e.g. root and oracle in this example) – login as the user and set a password for vnc

/usr/bin/vncpasswd

Now cd into the .vnc dir

cd
cd .vnc
cp -p xstartup xstartup.bak

vi xstartup and add the following lines, and comment out twm &

/home/oracle/.vnc
[oracle@ebs .vnc]$ cat xstartup
#!/bin/sh

startx &
exec gnome-session &
# twm &

Client Desktop Setup
I usually just install the latest RealVNC viewer only on Windows
The ports you actually connect thru are 5901… add 5900 to the ports in the vncservers config file.
Turn off firewalls if there is a question on on your desktop firewall
Miscellaneous Issues
Installing GNOME:
http://idevelopment.info/data/Unix/Linux/LINUX_AddGNOMEToCentOSMinimalInstall.shtml
vnc accept clipboard from viewers – or blank grey screen – this one is resolved by “start & exec gnome &” in /home/<user>/.vnc/xstartup

Leave a Comment

Scroll to Top