Headless CentOS 5.4 Linux using GDM/VNC

I have tested this on CentOS 5.4 and Fedora 11.

Make the following changes:

To /etc/gdm/custom.conf add:
[daemon]
RemoteGreeter=/usr/libexec/gdmgreeter

[xdmcp]
Enable=true
MaxSessions=30
DisplaysPerHost=1

To /etc/services:
vnc1024           5900/tcp          #vnc & gdm @ 1024×768 resolution
vnc800            5901/tcp          #vnc & gdm @ 800×600 resolution

Create /etc/xinetd.d/vnc800 with the following:
service vnc800
{
disable  = no
socket-type = stream
protocol = tcp
group           =       tty
wait  = no
user  = nobody
server  = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 800×600 -depth 16 -once -fp unix/:7100 -securitytypes=none
}

Create /etc/xinetd.d/vnc1024 with the following:
service vnc1024
{
disable  = no
socket-type = stream
protocol = tcp
group           =       tty
wait  = no
user  = nobody
server  = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp unix/:7100 -securitytypes=none
}

*Turn off vncserver*

We don’t want a vnc server now, so make sure it doesn’t run with

chkconfig –level 2345 vncserver off

And then do the following:

init 3
init 5

chkconfig –level 2345 xinetd on

service xinetd restart

All should be complete.

*Testing*

Use RealVNC or vncviewer to connect to the IP address of the machine you just setup.  By default, if you do not specify a display (10.10.10.30:1) the VNC client will connect to display 0 which is the service you setup on port 5900.  If you want a display that is 800×600 for the default display then setup the vnc800 service on port 5900.

Leave a Reply