Page 1 of 1

How to Configure VNC Server on RHEL 5 or Centos 5.4 server

Posted: Wed Jan 06, 2010 2:13 pm
by Kamran.Ahmed
This is to setup VNC to provide access to the local default X console as if you are sitting on the physical console. (These instructions are not for providing level 5 display for individual users):


To set up VNC to control the native X server, follow these steps:


On the system you want to control with VNC, run the program vncpasswd as root to set a VNC password. You will use this password when connecting with vncviewer or another VNC remote control program.


Edit the file /etc/X11/xorg.conf on RHEL 5

Create the section called Module in the end of the file and add following lines:
Section "Module"
Load "glx"
Load "dbe"
Load "extmod"
Load "freetype"
Load "type1"
Load "dri"
Load "vnc"

Make sure this is on a new line before EndSection.

In section called Screen, add this line:
Option "passwordFile" "/root/.vnc/passwd"

Make sure this is on a new line before EndSection.


Allow the ports in Firewall

1. SSH to the server and Run the following tool:
2. # system-config-securitylevel
3. In the "Other ports", please add a range as in below example. Note that those will be TCP ports as below:


4. Save and close the tool then restart firewall:
# service iptables restart


Make sure using chkconfig that vncserver is enabled for level 2,3,4,5. Then RESTART the machine.

Note: If you suspect the firewall blocking, then disable the firewall altogether and test VNC if it works. I use tightVNC and realvnc to test.

VNC will typically use port 59xx, where "xx" is the console number. Use the command netstat -na | less to see the ports that are open on the system. Look in the 5xxx range for VNC.

Note: I am not the author of this Howto i have found it very useful and 100 working then i wanted to share the info