Sunday, July 29, 2007

Redhat Vnc Config

This tutorial covers the essentials on how to get a vnc-server up and running from the shell. I'm not good at writing a lengthy tutorial, so I'll just get right down to it. For this tutorial I am assuming that you are using a RedHat , or RedHat Based distribution, like Fedora , RHEL, or any other derivitives. I released this tutorial on fedoraforums.org, everybody basically attacked it, pointing to a better one. Anyways, this is an entirely different setup then any of the other ones I have seen mentioned,as well as the end result is somewhat different. In anycase, something can be learned from either or.

Step 1: Installing the server

First of all we need to get the vnc-server package installed, before we can do anything. Log in as root and run the following commands

yum -y install vnc-server

chkconfig --level 5 vncserver on


Step 2: User Specific VNC Configuration

For this next step we are going to need a command-line text editor. If you do not have one, I would recommend you use joe. to get joe just use "yum -y install joe" from root.

now navigate to /home/ "HOME DIRECTORY HERE"/.vnc

for me it would be

cd /home/darkscript/.vnc

use joe to edit the xstartup file

joe xstartup





uncomment the following 2 lines by removing the # sign before them.

#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc

if you dont uncomment those 2 lines, when the vncserver is configured, it will use the tvm window manager, instead of gnome, kde, blackbox, or whatever you use... and btw... TVM really SUCKS.
Step 3: System Wide VNC Settings

Next comes the cool part. Up till now, the server wont accept incoming connections because it isn't configured to accept them yet.. Here is the really cool part, you can configure the vncserver to work like this.

host:1 will connect to darkscript

host:2 will connect to root

host:3 will connect to cloudyone

you can keep on going with however many users you want to have on your system.

joe /etc/sysconfig/vncservers

Edit the file As follows. **NOTE: Anything prefixed with a # is a comment and is ignored by the system**


# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# .

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 1280x720 -nolisten tcp -nohttpd -localhost"

VNCSERVERS="1:darkscript"
VNCSERVERARGS[1]="-geometry 1024x768'







I hope editing that is self explainitory... but basically here is what really matters. Say I wanted host:0 to be root and host:1 to be darkscript ,you would set the variables as follows

VNCSERVERS="0:root 1:darkscript"

VNCSERVERARGS[0]="-geometry 1024x768"

VNCSERVERARGS[1]="-geometry 1024x768"

now save the file with ctrl +K + X



Step 4: Updating the Firewall

HORRAY! Were almost done... Now we simply have set our firewall to allow the ports 5900, 5901, and however many other hosts you have added, if you dont know "host:1" would map out to host:5901 , host 2 would map out to 5902, so keep that in mind when your setting up your firewall

So for this part, use lokkit

so once you open up lokkit, navigate over to customize, and add the ports down where it says "other ports"

the syntax is as follows

5900:tcp 5900:udp 5901:tcp 5901:udp 5902:tcp 5902:udp


Step 5: Automatic X11 Startup

Allright, Now for the final step, we need the machine to automatically start in runlevel five, so for this part just use joe again to edit /etc/grub.conf

Now edit that.just for an easy rule of thumb, everywhere it says quiet, add 5 at the end of it...for example... rhgb quiet 5. I'll be adding an example file in sooner or later...

Now Reboot your machine with shutdown -r now, and you are good to go.

No comments: