Install VNC Server and Desktop on CentOS 6

Install the desktop environment that we will use:
yum groupinstall Desktop -y

Install the TigerVNC server used for VNC access and a required package:
yum install tigervnc-server xorg-x11-fonts-Type1 -y

Enable VNC server at boot:
chkconfig vncserver on

Create a VNC password for your logged in user:
vncpasswd

Now edit the /etc/sysconfig/vncservers file and add the following to the end:
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1400x700"

Make sure to change "1:root" to "1:<user>", changing the user to the user account you with to use with VNC. Also change the resolution to the dimensions you like then save the file.

Now add proper iptables firewall rules to allow VNC access remotely:
iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
service iptables save
service iptables restart

Now restart the VNC server then kill the active session so we can make a config change:
service vncserver restart
vncserver -kill :1

Now edit the xstartup file inside the .vnc directory of your users home directory.
nano .vnc/xstartup

Comment out the last line then set to execute gnome by adding this line:
#twm &
exec gnome-session &

Now save the file and exit, then restart the VNC server.
service vncserver restart

You should now be able to connect using a VNC client of choice on a remote computer. I recommend using RealVNC Client. Connect to your VNC at <server_ip>:1, 1 being the port.

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

Install ownCloud on CentOS 6

We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...

Install PPTP / PPP Proxy Server on CentOS 6

PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...

Install Multicraft 2.0 on CentOS 6

Run a Minecraft server? Multicraft is the most commonly used management control panel for...

Setup Teamspeak 3 Server on Linux (CentOS)

If you run a gaming community, a Teamspeak 3 server is probably a popular choice for you to have...

Install LAMP on CentOS 6 (MySQL 5.5, PHP 5.6)

This brief guide will show you how to successfully install a LAMP stack (Linux, Apache, MySQL,...

Powered by WHMCompleteSolution