Installing and Configuring VNC Server on Linux

In this post I am going to share the steps to install VNC server on Linux/Oracle Enterprise Linux server.

1)Install the VNC Server.

yum install tigervnc-server

2) Edit the file "/etc/sysconfig/vncservers" file to configure the required displays. 

 Note: Multiple "display:user" pairs are defined on a single line, but the arguments for each display are defined separately.

VNCSERVERS="2:root 3:oracle"
VNCSERVERARGS[2]="-geometry 1280x1024 -nolisten tcp -localhost"
VNCSERVERARGS[3]="-geometry 1280x1024"

3) Setup the VNC password for all users defined in the "/etc/sysconfig/vncservers" file.
Root User
# vncpasswd

Oracle User
# su - oracle
$ vncpasswd

4) From root user enable the "vncserver" service for autostart and start the service.

chkconfig vncserver on
 service vncserver start

5)Now install/use VNC viewer to connect to system using the display numbers and passwords defined.
hostname:2--> for root
hostname:3--> for oracle

6)Use the following commands to stop the service and disable autostart.

service vncserver stop
chkconfig vncserver off