How to install and configure VNC Server on CentOS or RHEL 5/6

How to install and configure VNC Server on CentOS or RHEL 5/6

by -
0 2929

A brief introduction about VNC Server

VNC (Virtual Network Computing) server is used to connect remotely to a computer system. This allows a user to see and control one computer from multiple locations. Because this control is transmitted over the Internet, the computer can be viewed from anywhere in the world.

Server Informaiton

Note:  Article Tested on CentOS 5.4 & CentOS 6.5

Server IP Address    :  192.168.0.50
Server Hostname     :  vncserver.kvit.in
Package                   :  vnc-server      (for CentOS-5.4)
Package                   : tigervnc-server  (for CentOS-6.5)
Config File               :  /etc/sysconfig/vncserver
Service                     :  vncserver
Port no                     :  5802,5803,5902,6002,6003
SELinux Status        : Disabled

Client Information
Client IP Address : 192.168.0.61
Software required : RealVNC

Installation & Configuration VNC Server

Install Gnome Desktop package
If your linux machine is installed with minimal package means cli mode. Then firstly you will need to install Gnome/KDE Desktop environment package in your linux machine.

#For CentOS-5.4
[[email protected] ~]# yum groupinstall “GNOME Desktop Environment”

#For CentOS-6.5
[[email protected] ~]# yum groupinstall “Desktop”

Installing VNC Server package

To create VNC server environment on linux machine, you need to install VNC server package according to OS version.

#For CentOS-5.4
[[email protected] ~#]#yum install vnc-server

#For CentOS-6.5
[[email protected] ~]#yum install tigervnc-server

Create user for VNC

Creating vnc user and password on server, that will be used for remote desktop.

[[email protected] ~]# useradd kvit
[[email protected] ~]# passwd kvit

[[email protected] ~]# useradd openpath
[email protected] ~]# passwd openpath

Create VNC passwords for created users

[email protected] ~]# su – kvit
[[email protected] ~]$ vncpasswd
Password:******
Verify:******
[[email protected] ~]$exit
[email protected] ~]# su – openpath
[[email protected] ~]$ vncpasswd
Password:*****
Verify:*****
[[email protected] ~]$exit

Edit server configuration file
Add below given entry at the end of configuration /etc/sysconfig/vncservers file and make sure you change with yours.

[[email protected] ~]# vim /etc/sysconfig/vncservers
VNCSERVERS=”2:kvit”
VNCSERVERARGS[2]=”-geometry 800×600″

Note: VNCSERVERS parameter defines list of vnc users and VNCSERVERARGS[x] parameter defines the screen resolution size. Where “X” is display id of vnc user which woluld be call during remote access.

If you want to add more user for vnc access then make entry in config file parameter given as below.

VNCSERVERS=”2:kvit 3:openpath”
VNCSERVERARGS[2]=”-geometry 800×600″
VNCSERVERARGS[3]=”-geometry 800×600″

Start VNC Service

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

New ‘vncserver.kvit.in:2 (kvit)’ desktop is vncserver.kvit.in:2

Creating default startup script /home/kvit/.vnc/xstartup
Starting applications specified in /home/kvit/.vnc/xstartup
Log file is /home/kvit/.vnc/vncserver.kvit.in:2.log

3:openpath xauth: creating new authority file /home/openpath/.Xauthority
xauth: (stdin):1: bad display name “vncserver.kvit.in:3” in “add” command

New ‘vncserver.kvit.in:3 (openpath)’ desktop is vncserver.kvit.in:3

Creating default startup script /home/openpath/.vnc/xstartup
Starting applications specified in /home/openpath/.vnc/xstartup
Log file is /home/openpath/.vnc/vncserver.kvit.in:3.log

[ OK ]
[[email protected] ~]#

Note: on CentOS-5 version After starting vnc service edit xstartup script file and enable below given two line, which will help you to view full feature Graphical interface. And again restart vnc service.

[[email protected] ~]# vim /home/kvit/.vnc/xstartup
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[[email protected] ~]# service vncserver restart

Start vnc service automatically during startup

[[email protected] ~]# chkconfig vncsever on

Flush and save Iptables

You can flush iptables default rule, if unable to connect remote session.

[[email protected] ~#]# iptables -F
[[email protected] ~#]# service iptables save
[[email protected] ~#]# service iptables restart

Connect Server remotly from client end

Now Download software for windows or Linux machine and install it.
Following websits are:
1. RealVNC
2. TightVNC

Now Open VNC client for remote access. Enter server ip address along with display number and vnc user password.

vnc1

vnc2

vnc3

CentOS-5.4 Graphical View

vnc4

CentOS-6.5 Graphical View

vnc6.5

Download PDF

CEO, KV IT-Solutions Pvt. Ltd. | [email protected] | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “

SIMILAR ARTICLES

0 1592

0 1238

0 1131

NO COMMENTS

Leave a Reply