How to Setup VNC Server on CentOS 6.3

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.

See also  How to Remove a Logical Volume on CentOS 6.3/RHEL6

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.

See also  How to Install Apache Httpd Server on RHEL 6

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 :

See also  How to Enable Logging for Email Subject Fields in Postfix Maillog


Example :

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7

This short howto will explain the steps to reset a lost root password or to reset a forgotten root password on Linux RHEL 7 or CentOS 7. Basically, we will...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

1 Comment

  • Avatar for Alle Efendi Alle Efendi says:

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

1 Trackback or Pingback

  • Vnc Server On Centos | Kuplux's

Leave a Reply to Alle Efendi Cancel reply

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