How to Setup VNC Server on CentOS 6.3

Share this Article :

VNC-logoVNC is a protocol that is used to display an X windows session running on another computer over the network. VNC server must be install at the target(destination) workstation and source or client will access the target workstatio using VNC client. In this post, it was assumed that the VNC server will be install on CentOS 6.3 and will be access by Win XP client using portable VNC client(VNC viewer). Meaning to say that the desktop on CentOS will be shared with others. If you are running CentOS 5 and below, yum command install will recognize vnc-server. But in CentOS 6, If you are running CentOS 6, the server is: tigervnc-server not: vnc-server will be replace with tigervnc-server not.

1. Install VNC server on CentOS 6.3 using yum command :

[[email protected] ~]# yum install tigervnc-server -y

2. As a root, create the user that will use VNC user accounts :

[[email protected] ~]# useradd ehowstuff
[[email protected] ~]# useradd mhstar
[[email protected] ~]# passwd ehowstuff
[[email protected] ~]# passwd mhstar

3. Edit /etc/sysconfig/vncservers, and add the following :

VNCSERVERS="1:ehowstuff 2:mhstar"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 640x480"

ehowstuff will have an 800 by 600 screen and mhstar will have a 640×480 screen.

4. Set VNC passwords for each users :

[[email protected] ~]# su - ehowstuff
[[email protected] ~]$ vncpasswd
Password:
Verify:
[[email protected] ~]$ cd .vnc
[[email protected] .vnc]$ ls
passwd
[[email protected] .vnc]$ exit
logout
[[email protected] ~]# su - mhstar
[[email protected] ~]$ vncpasswd
Password:
Verify:
[[email protected] ~]$ cd .vnc
[[email protected] .vnc]$ ls
passwd
[[email protected] .vnc]$ exit
logout

Switch user into the account for each user. Run vncpasswd will create the ~/.vnc directory.

5. Start vncserver as a root :

[[email protected] ~]# service vncserver start
Starting VNC server: 1:ehowstuff xauth:  creating new authority file /home/ehowstuff/.Xauthority
xauth: (stdin):1:  bad display name "CentOS6.3:1" in "add" command

New 'CentOS6.3:1 (ehowstuff)' desktop is CentOS6.3:1

Creating default startup script /home/ehowstuff/.vnc/xstartup
Starting applications specified in /home/ehowstuff/.vnc/xstartup
Log file is /home/ehowstuff/.vnc/CentOS6.3:1.log

2:mhstar xauth:  creating new authority file /home/mhstar/.Xauthority
xauth: (stdin):1:  bad display name "CentOS6.3:2" in "add" command

New 'CentOS6.3:2 (mhstar)' desktop is CentOS6.3:2

Creating default startup script /home/mhstar/.vnc/xstartup
Starting applications specified in /home/mhstar/.vnc/xstartup
Log file is /home/mhstar/.vnc/CentOS6.3:2.log

                                                           [  OK  ]

6. Stopping the vncserver as root :

[[email protected] ~]# service vncserver stop
Shutting down VNC server: 1:ehowstuff 2:mhstar             [  OK  ]

7. Set the VNC service to be automatically start at boot :

[[email protected] ~]# chkconfig vncserver on

8. Use VNC viewer to connect VNC server :


Example :

One Response

  1. Alle Efendi

Leave a Reply