I want to set up a vncserver on a generic/clean Centos or RH type Linux. I am working within the AWS EC2 infrastructure but that should not matter I believe.
To make this effort succeed there are some prerequisites we need to help us run the vnc session i.e., X Windows.
I've installed all the usual packages, facilitated by yum, and followed every bit of advice I can find on the internet
# Start by installing the X Windows System (-y to auto accept)
yum groupinstall -y "X Window System"
then
# Install the VNC stuff
yum install -y tigervnc-server tigervnc-server-module
but when I try to start vnc
service vncserver start
I get error text like this (after you run vncpasswd and modify /etc/sysconfig/vncservers)
bash-4.1# service vncserver start
Starting VNC server: 2:root xauth: creating new authority file /root/.Xauthority
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
Xvnc TigerVNC 1.1.0 - built Feb 22 2013 22:28:37
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11300000, The X.Org Foundation
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC
Mon Apr 1 01:09:13 2013
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5902
vncext: created VNC server for screen 0
[dix] Could not init font path element catalogue:/etc/X11/fontpath.d, removing from list!
[dix] Could not init font path element built-ins, removing from list!
Fatal server error:
could not open default font 'fixed'
I have tried all the advices and tips on the internet about installing fonts, creating links, renaming x,y and z to no avail. How can I get it to work?
The magic combination of yum installs to get this working for me was as follows:
yum groupinstall -y "X Window System"
yum install -y tigervnc-server tigervnc-server-module libXfont pixman xterm xorg-x11-twm
chkconfig --level 345 vncserver on
then for convenience maybe something like this to get it going
echo 'VNCSERVERS="2:root"' >> /etc/sysconfig/vncservers
This is assuming you are doing this all as root and you are happy to start your vncserver on DISPLAY 2.
If you get connection refused errors from any attempt to connect to the vncserver once it is running check a couple of things:
Your local firewall (iptables) or otherwise allows connections to 5902 (or another port your server is using)
You have not forbidden remote connection to the vncserver via the VNCSERVERARGS option in /etc/sysconfig/vncservers like this:
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
Something like
tcpdump port 5902
can help you decide if it is a local or remote firewall problem etc.