Install VNC Server on CentOS

First install vncserver as user root

yum install vnc-server

I wanted VNC run as user “flashwebhost” as it is not recommended to use Desktop as user root, so i created a user

adduser flashwebhost

Now setup VNC Password for this user

su - flashwebhost
vncserver

It ask password 2 times. You need this password to connect with VNC Viewer.

Now kill the VNC Server

vncserver -kill :1

:1 is display number. Mostly it will be 1.

Type exit to go back to root shell.

Now edit /etc/sysconfig/vncservers

vi /etc/sysconfig/vncservers

Add following content to the file, save and exit.

VNCSERVERS="1:flashwebhost"
VNCSERVERARGS[1]="-geometry 1024x768"

Now start VNC Server

[root@sam /]# service vncserver start
Starting VNC server: 1:flashwebhost
New 'sam.localhost:1 (flashwebhost)' desktop is sam.localhost:1

Starting applications specified in /home/flashwebhost/.vnc/xstartup
Log file is /home/flashwebhost/.vnc/sam.localhost:1.log

                                                           [  OK  ]
[root@sam /]#

Now you will be able to connect to the server with SERVER-IP:1

To start VNC Server on boot

chkconfig vncserver on
This entry was posted in OpenVZ and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>