Pages

Sunday, December 13, 2015

VNC configuration on Linux OS

Home
 
Installing Necessary RPMs for VNC

yum install vnc vnc-server
[root@testhost ~]# yum install vnc vnc-server
Loaded plugins: fastestmirror, kabi, refresh-packagekit, security
Loading support for CentOS kernel ABI
Loading mirror speeds from cached hostfile
 * base: mirror.leapswitch.com
 * epel: mirrors.ispros.com.bd
 * extras: mirror.leapswitch.com
 * updates: mirror.leapswitch.com
Setting up Install Process
Package tigervnc-1.1.0-5.el6_4.1.x86_64 already installed and latest version
Package tigervnc-server-1.1.0-5.el6_4.1.x86_64 already installed and latest version
Nothing to do


List files available against installed RPM 

[root@testhost ~]# rpm -ql tigervnc-server-1.1.0-5.el6_4.1.x86_64
/etc/rc.d/init.d/vncserver
/etc/sysconfig/vncservers
/usr/bin/Xvnc
/usr/bin/vncconfig
/usr/bin/vncpasswd
/usr/bin/vncserver
/usr/bin/x0vncserver
/usr/share/man/man1/Xvnc.1.gz
/usr/share/man/man1/vncconfig.1.gz
/usr/share/man/man1/vncpasswd.1.gz
/usr/share/man/man1/vncserver.1.gz
/usr/share/man/man1/x0vncserver.1.gz



Set password for the user using which the VNC services are to be started  using vncpasswd command



[root@testhost ~]# vncpasswd
Password:
Verify:


[root@testhost ~]# cat /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-localhost" to prevent remote VNC clients connecting except when

# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

To set Display and user in VNC Configuration file


Now for the important pieces.The first phase of this step is to edit the /etc/sysconfig/vncservers file. At the end of that file, enter the following:

VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1600x1200"
NOTE: You can set the geometry to whatever resolution you require.


In the above section, you can set up multiple users for connection. Say you had three users that needed access using different resolutions. To accomplish this, you could enter something like:

VNCSERVERS="1:vncuser1 2:vncuser2 3:vncuser3"

VNCSERVERARGS[1]="-geometry 640x480"

VNCSERVERARGS[2]="-geometry 800x600"

VNCSERVERARGS[3]="-geometry 1600x1200"

Below is the sample working entry added in file /etc/sysconfig/vncservers

VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

Start the Daemon of VNCServer


[root@testhost ~]# /etc/init.d/vncserver start
Starting VNC server: 2:root
New 'testhost:2 (root)' desktop is testhost:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/testhost:2.log                    [  OK  ]

[root@testhost ~]# ps -ef |grep vnc
root      7249     1  0 11:50 pts/3    00:00:00 /usr/bin/Xvnc :2 -desktop testhost:2 (root) -auth /root/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp -localhost
root      7256  7255  0 11:50 pts/3    00:00:00 vncconfig -iconic
root      8078  5632  0 12:18 pts/3    00:00:00 grep vnc



To start the NEW VNC connection


[root@testhost ~]# vncserver
Warning: testhost:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server testhost:1
New 'testhost:3 (root)' desktop is testhost:3
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/testhost:3.log


To Check for the New Connection process details 

[root@testhost ~]# ps -ef |grep vnc
root      8114     1  3 12:21 pts/3    00:00:01 /usr/bin/Xvnc :3 -desktop testhost:3 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5903 -fp catalogue:/etc/X11/fontpath.d -pn
root      8120  8119  0 12:21 pts/3    00:00:00 vncconfig -iconic
root      8582     1  8 12:22 pts/3    00:00:00 /usr/bin/Xvnc :2 -desktop testhost:2 (root) -auth /root/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp -localhost
root      8588  8587  0 12:22 pts/3    00:00:00 vncconfig -iconic
root      8985  5632  0 12:22 pts/3    00:00:00 grep vnc


To Check for the port details of New Connection process details using netstat



[root@testhost ~]# netstat -nautp |grep 8114
tcp        0      0 0.0.0.0:5903          0.0.0.0:*                   LISTEN      8114/Xvnc
tcp        0      0 0.0.0.0:6003         0.0.0.0:*                   LISTEN      8114/Xvnc
tcp        0      0 :::6003              :::*                        LISTEN      8114/Xvnc

Back To Top
Home

No comments:

Post a Comment