How to Setup VNC Server on CentOS 6.3

Related Articles

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 :

[root@CentOS6 ~]# yum install tigervnc-server -y

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

[root@CentOS6 ~]# useradd ehowstuff
[root@CentOS6 ~]# useradd mhstar
[root@CentOS6 ~]# passwd ehowstuff
[root@CentOS6 ~]# 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 :

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

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

5. Start vncserver as a root :

[root@CentOS6 ~]# 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 :

[root@CentOS6 ~]# service vncserver stop
Shutting down VNC server: 1:ehowstuff 2:mhstar             [  OK  ]

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

[root@CentOS6 ~]# chkconfig vncserver on

8. Use VNC viewer to connect VNC server :


Example :

Sign up for the WP Engine affiliate program and receive a minimum of $150 per referral!

As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below. Jumping through archives page to read more articles..


Skytech is a part time blogger that has over 6 years experience in servicing, repairing and configuring computers and administering the server systems.

Related Articles

  • Alle Efendi

    i can connected with that tutorial. but why desktop still black and nothing happend
    im waiting 10minutes still just black

Powered by WordPress · Designed by Theme Junkie