Saturday, February 10, 2007

Access Gnome on Fedora 6 via VNC on reboot.

So I was hoping to use a spare PC as a test bed for some open source apps. I was looking to eliminate any questions as to where a configuration problem might lie and since I didn't have any schedule in mind, I figured I would install Fedora 6, as opposed to running a live CD or a VMWare image.
Without a KVM handy, and not wanting to pile another keyboard / mouse / monitor combo on my desk, I imagined I would run it headless and use VNC or an equivalent for control.

How to access a GNOME desktop on a PC running Fedora Core 6 via VNC without a user logging on locally.

1. Add a user "Joe".
2. Edit /etc/sysconfig/vncservers.

VNCSERVERARGS[1]="-geometry 1024x768 -depth 24"
This will start an instance of vncserver using display 1, with joe as the user, at a 1024x768 resolution and a 24 bit color depth.

3. Run vncpasswd as Joe to set the vnc password.
4. As root, restart vnc by service vncserver restart.
5. As root, get vnc to start on boot by chkconfig vncserver on.
6. Edit /joe/.vnc/xstartup to include only:

exec /usr/bin/gnome-session

Run vncviewer from another host, and connect to hostname:5901. You must use the port number 5900 + whatever display number you've indicated in the vncservers file above. You will be running a Gnome desktop as Joe. The user at the Fedora PC will be looking at a user login screen.