This page explains how to install VNC on your Cloud Server. This article was based upon the CentOS 5 distribution. This tutorial assumes you have root access to your server and are running on a clean installation.
Note: In order to use this you must have at least 512MB of RAM or X Windows will not run.
WARNING: Running VNC on your Cloud Server will consume large amounts of bandwidth. Please use wisely!
If you would like information about tunnelling VNC over SSH please visit http://martybugs.net/smoothwall/puttyvnc.cgi
Contents |
This article will assume you know how to use the YUM (YUM Update Manager) from the CentOS - Setup article.
# yum install perl
We will need to install the X-Windows platform to run the graphical portion of this project. X11 is a graphical display server, and will server and will sit above the Window Manager.
To install run the following as root:
# yum groupinstall "X Window System"
KDE, GNOME and TWM are all Window Managers and are the human usable layer that you are probably familiar with. This gives you the access to use a mouse and send calls to the X11 server.
# yum groupinstall "KDE Desktop"
Also, this may be needed:
# yum install kde-session
# yum groupinstall "GNOME Desktop Environment"
Also, this may be needed:
# yum install gnome-session
TWM is the default X-Window Manager and you don't have to install any additional packages, it is light and will run on almost anything, but is also not very user friendly and almost requires a power-user.
VNC is the service that display your X output to a tcp connection over the internet.
# yum install vnc-server
# nano /etc/sysconfig/vncservers
Insert the following lines into the file:
VNCSERVERS="1:someguy" VNCSERVERARGS[1]="-geometry 800x600 -depth 16"
This will create a VNC session for one user with the username of someguy. If you would like to setup multiple users you will need to add additional users to that line. For example...
1:someguy 2:someperson 3:somegirl
You will also need to add additional VNCSERVERARGS lines to correspond to each user. Change the [1] to match the session number.
If you have a firewall running, you will need to open port 5901. For example, on CentOS, run:
# iptables -I INPUT 1 -p tcp --dport 5901 -j ACCEPT
If needed, replace 5901 with a range, depending on the number of sessions required (e.g. 5901:5905).
Save the new iptables rule:
# service iptables save
# su username $ cd ~
take note of the '.' in front of the name
$ mkdir .vnc $ cd .vnc
Insert the configuration below (this is for a KDE-VNC session):
#!/bin/sh 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" & startx & exec kde-session &
Make the file executable:
$ chmod u+x xstartup
Set the user's private VNC connection password
# vncpasswd
Make sure you exit out of your user session and go back to 'root'.
start the server:
# service vncserver start
Open up your VNC client and type in your external IP address, colon, then your session ID configured in /etc/sysconfig/vncservers. The session number must correspond to the user name or it will not connect.
Example: 64.25.25.25:1
To close the connection simple close the window.
To stop the VNC server type the following:
# service vncserver stop
Kelly Koehn 14:24, 17 March 2009 (CDT)
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

5 Comments
Article ID: 502 - Wrong groupinstall
yum groupinstall "KDE (K Desktop Environment)"
to:
yum groupinstall "KDE Desktop"
re: groupinstall
Article ID: 502 - Change iptables Rule / Add iptables save
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 5901 -j ACCEPT
to:
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
Also you might want to add the command "service iptables save"
So that changes will be saved.
Notes: This was needed for CentOS 6.3
re: iptables
CentOS 6.3
Add new comment