Procedure to setup VNC server to access the GUI ( x Server) from VNC client remotely.
===============================================================
1) cat /etc/sysconfig/vncservers
VNCSERVERS="1:sachin" ==> PORT 2 on secured env will throw connection error
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
2) [root]# su - sachin
-bash-4.1$ whoami
sachin
-bash-4.1$ vncpasswd
Password:
Verify:
-bash-4.1$
3) service vncserver stop
4) service vncserver start
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@ ~]# vncserver -help
usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]
[-geometry <width>x<height>]
[-pixelformat rgbNNN|bgrNNN]
[-fp <font-path>]
[-fg]
[-autokill]
<Xvnc-options>...
vncserver -kill <X-display>
vncserver -list
[root@ ~]#
=====================================================
[root@~]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
[root@ ~]#
=============================================================
[root@]# service vncserver status
Xvnc is stopped
[root@]# service vncserver start
Starting VNC server: no displays configured [FAILED]
[root@ ]#
============================================
[root@ sachin]# 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"
VNCSERVERS="1:sachin"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
[root@]#
NOTE: PORT 2 on secured env will throw connection error
============================================
[root@sachin]# service vncserver status
Xvnc is stopped
[root@sachin]# service vncserver start
Starting VNC server: 2:sachin xauth: creating new authority file /myhome/sachin/.Xauthority
New 'bgqxxx:2 (sachin)' desktop is bgqxxxa:2
Creating default startup script /bglhome/sachinpb/.vnc/xstartup
Starting applications specified in /bglhome/sachin/.vnc/xstartup
Log file is /bglhome/sachin/.vnc/bgqxxx:2.log
[ OK ]
[root@ sachin]#
=====================================================
If you are not able to connect VNC server from VNC client , then Change the PORT to 1 in config file and start vncserver again.
[root@sachin]# ps -ef | grep vnc
sachin 2630 1 0 23:17 ? 00:00:01 /usr/bin/Xvnc :2 -desktop bgqxxx:2 (sachin) -auth /myhome/sachin/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /myhome/sachin/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp -localhost
sachin 2649 2647 0 23:17 ? 00:00:00 vncconfig -iconic
root 3680 10443 0 23:24 pts/8 00:00:00 grep --color=auto vnc
[root@ sachin]#
=======================================================================
Example : showing TotalView screen for MPI_hello_world_Program
NOTE: Putty would throw this error and needs VNC client to connect X server to use TotalView Graphical User Interface .
-bash-4.1$ export LM_LICENSE_FILE=/myusr/mtn/totalview/toolworks/flexlm-10.8.0-3/license.dat
-bash-4.1$ /myusr/mtn/totalview/current/bin/totalview -my_io_interface 172.16.1.2 runjob -a --exe /myusr/mtn/a.out --block R-M-N
Unable to open X display. Please check your $DISPLAY environment
variable to ensure that it is defined correctly and that you are
authorized to connect to this X server.
-bash-4.1$
++++++++++++++++++++++++++END ++++++++++++++++++++++++
Reference :
http://linuxconfig.org/configuring-vnc-server-access-on-a-redhat-linux
===============================================================
1) cat /etc/sysconfig/vncservers
VNCSERVERS="1:sachin" ==> PORT 2 on secured env will throw connection error
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
2) [root]# su - sachin
-bash-4.1$ whoami
sachin
-bash-4.1$ vncpasswd
Password:
Verify:
-bash-4.1$
3) service vncserver stop
4) service vncserver start
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@ ~]# vncserver -help
usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]
[-geometry <width>x<height>]
[-pixelformat rgbNNN|bgrNNN]
[-fp <font-path>]
[-fg]
[-autokill]
<Xvnc-options>...
vncserver -kill <X-display>
vncserver -list
[root@ ~]#
=====================================================
[root@~]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
[root@ ~]#
=============================================================
[root@]# service vncserver status
Xvnc is stopped
[root@]# service vncserver start
Starting VNC server: no displays configured [FAILED]
[root@ ]#
============================================
[root@ sachin]# 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"
VNCSERVERS="1:sachin"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
[root@]#
NOTE: PORT 2 on secured env will throw connection error
============================================
[root@sachin]# service vncserver status
Xvnc is stopped
[root@sachin]# service vncserver start
Starting VNC server: 2:sachin xauth: creating new authority file /myhome/sachin/.Xauthority
New 'bgqxxx:2 (sachin)' desktop is bgqxxxa:2
Creating default startup script /bglhome/sachinpb/.vnc/xstartup
Starting applications specified in /bglhome/sachin/.vnc/xstartup
Log file is /bglhome/sachin/.vnc/bgqxxx:2.log
[ OK ]
[root@ sachin]#
=====================================================
If you are not able to connect VNC server from VNC client , then Change the PORT to 1 in config file and start vncserver again.
[root@sachin]# ps -ef | grep vnc
sachin 2630 1 0 23:17 ? 00:00:01 /usr/bin/Xvnc :2 -desktop bgqxxx:2 (sachin) -auth /myhome/sachin/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /myhome/sachin/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp -localhost
sachin 2649 2647 0 23:17 ? 00:00:00 vncconfig -iconic
root 3680 10443 0 23:24 pts/8 00:00:00 grep --color=auto vnc
[root@ sachin]#
=======================================================================
Example : showing TotalView screen for MPI_hello_world_Program
NOTE: Putty would throw this error and needs VNC client to connect X server to use TotalView Graphical User Interface .
-bash-4.1$ export LM_LICENSE_FILE=/myusr/mtn/totalview/toolworks/flexlm-10.8.0-3/license.dat
-bash-4.1$ /myusr/mtn/totalview/current/bin/totalview -my_io_interface 172.16.1.2 runjob -a --exe /myusr/mtn/a.out --block R-M-N
Unable to open X display. Please check your $DISPLAY environment
variable to ensure that it is defined correctly and that you are
authorized to connect to this X server.
-bash-4.1$
++++++++++++++++++++++++++END ++++++++++++++++++++++++
Reference :
http://linuxconfig.org/configuring-vnc-server-access-on-a-redhat-linux