Thursday, February 9, 2017

Configure CentOS 6 VNC Server

One of the first things I like to do when provisioning a CentOS 6 server with a desktop GUI is to configure remote desktop; but the standard/included server (vino) only works when a user is already logged in. I want to usually be able to log-in remotely (in other words, have my VNC session log me in to a machine that has no users logged-in).

First, install and enable the VNC server:
# yum install tigervnc-server
# yum install xorg-x11-fonts-Type1
# chkconfig vncserver on
Set VNC password for your user:
# su - USER
# vncpasswd
# exit
Add the following lines to the following file:
# vim /etc/sysconfig/vncservers 
VNCSERVERS="1:USER"
VNCSERVERARGS[1]="-geometry 800x600"
Add port 5900 (TCP and UDP) to your firewall allow rules (I just did this graphically at the machine's physical terminal, but you can use iptables in the CLI).

See if VNC server comes up:
# service vncserver restart
Edit the user's vnc configuration to replace the "twm &" line with the following:
# service vncserver stop
# vim /home/USER/.vnc/xstartup 
exec gnome-session &
Test VNC server startup again:
# service vncserver restart
At this point, you should be able to point a VNC client at your machine, and you will automatically be logged-in. Note, it usually takes a little time... up to a minute or so, typically.

No comments:

Post a Comment