Skip to content

RealVNC on RedHat Enterprise 5

This describes how to use the free versions of RealVNC to connect to your RedHat Enterpirse Linux 5 desktop from your Windows XP machine.  These instructions might work for RHEL4, CentOS, Windows Vista, and other flavors of Linux, but I haven’t tried them.  YMMV.

First download the latest free version for Linux to your RedHat machine from here:

http://www.realvnc.com/cgi-bin/download.cgi

Note:  Since you are on RedHat, make it easy on yourself and grab the RPM version.

Unzip/Untar the file to extract the RPM, then install it:

rpm -i vnc-4.*.*.*.rpm

Next, you will need to edit the script which launches RealVNC or else it will choke on the font paths.  So, as root, edit this file:

/usr/bin/vncserver

You should see a section in that file that looks like this:

# Add font path and color database stuff here, e.g.:
#
# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
# $cmd .= " -co /usr/lib/X11/rgb";
#

To jump to it quickly, just search for the word ‘font’ in your editor.

Now, you want to uncomment and edit the two necessary lines so that it looks like this:

# Add font path and color database stuff here, e.g.:
#
$cmd .= " -fp /usr/share/X11/fonts/misc/,/usr/share/X11/fonts/75dpi/";
$cmd .= " -co /usr/share/X11/rgb";
#

Got it? Good.  Save that sucker and close it.

Don’t Run RealVNC As Root.

You need to be logged in as a non-root user when you fire up the VNC server, lest the application bomb out with errors.  So, once you have chosen the user you wish to be,  log in and edit this file:

/home/username/.vnc/xstartup

You will want to change the last line to use your GUI of choice (I prefer Gnome).

Change:

twm &

To:

gnome-session &

Save that sucker.  Got it? Good.

There is one last thing to do before any of this will work, and that is to open the necessary port in your firewall.  On your RedHat box, open the Firewall editor and add port 5901 to the list of allowed ports.

Fire It Up

Logged in as the non-root user you decided to run this as, enter the following at the command line:

#> vncserver :1

The first time you run this, you will be asked to create a password. Choose something you will remember by the time you get to your Windows machine to connect in a few minutes.

You should see a few notes about the server being started and the log file being created.  And with that, the vnc server is ready for connections from your Windows box.

Setting Up Windows

Now, you need to download and install the free RealVNC viewer to connect to your RedHat machine, which again is available here:

http://www.realvnc.com/cgi-bin/download.cgi

When installing, choose the Viewer option, not the Server option.  Once it’s installed, launch the application, and in the Server field, enter the IP or hostname of your RedHat server, followed by :1.  For example:

192.168.1.2:1

Click OK, and you should be asked to enter the password you created a few minutes ago.  Once you do, if all worked as planned, you should be looking at your RedHat desktop on your Windows machine.

Notes

Stopping RealVNC

Sometimes you may need to stop and restart VNC on the RedHat box.  To do this, log in at the command line and enter:

#> vncserver -kill :1

It should say something like “Killing process 5036”, letting you know it has been completed.

Getting A Better Resolution

If your Windows box has a monitor running at a resolution different than that of your Linux box, you may want to change the resolution at which RealVNC runs.  To do this, just add the desired resolution to the startup command like so:

#> vncserver -geometry 1440x900 :1
Published inLinuxRedHatVNC

2 Comments

  1. Then quickly disable your VNC server until you learn to forward it through a SSH tunnel….as VNC is very insecure.

    Unless you have the premium edition.

    Maybe there will be a part 2 for the secure tunnel? 😉

    I’m to lazy to write it.

Leave a Reply to dbcooper Cancel reply

Your email address will not be published. Required fields are marked *