configure VNC ( Virtual Network Computing ) in centos
Installing VNC:
1. First, we should check whether the RPM package for vnc server is installed in the server or not.
[root@domU-12-31-38-07-19-4B ~]# rpm -q vnc-server
package vnc-server is not installed
[root@domU-12-31-38-07-19-4B ~]#
If it is not installed, download the rpm package from http://rpm.pbone.net/. Please note that the OS version of the server is 64 bit. So, I have downloaded the 64 bit OS RPM. If it is a 32 bit OS then you should download 32 bit RPM.
[root@domU-12-31-38-07-19-4B ]# wget ftp://ftp.muug.mb.ca/mirror/centos/6.0/os/x86_64/Packages/tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64.rpm
The next step is to install the RPM package.
——————
[root@domU-12-31-38-07-19-4B ]# rpm -ivh tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64.rpm
——————
You may get the following dependency error while installing the rpm.
———–
error: Failed dependencies:
libXfont.so.1()(64bit) is needed by tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64
mesa-dri-drivers is needed by tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64
xkeyboard-config is needed by tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64
xorg-x11-fonts-misc is needed by tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64
———–
This indicates that the above package is not installed in the server. You can use yum command to install the above package.
—————
[root@domU-12-31-38-07-19-4B ]# yum install mesa-dri-drivers
[root@domU-12-31-38-07-19-4B ]# yum install libXfont.so.1
[root@domU-12-31-38-07-19-4B ]# yum install xkeyboard-config
[root@domU-12-31-38-07-19-4B ]# yum install xorg-x11-fonts-misc
—————
2. After installing the dependency package, we can install the downloaded rpm without any issue.
—————–
[root@domU-12-31-38-07-19-4B ]# rpm -ivh tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64.rpm
—————–
3. Now, we can install the VNC server and VNC to the server.
————
[root@domU-12-31-38-07-19-4B ]# yum install vnc-server
[root@domU-12-31-38-07-19-4B ]# yum install vnc
————
4. You have successfully installed VNC in your server. Inorder to use normal windows GUI interface, the server needs “Desktop” package. This package is already compiled to the server.
————-
[root@domU-12-31-38-07-19-4B]# yum groupinstall Desktop
————-
That’s it:) VNC will have been successfully installed in the server. Now, the next step is to configure VNC for the users.
Configuring VNC:
1. Create a system user and set the password for the users.
———-
[root@domU-12-31-38-07-19-4B ]# useradd myuser
[root@domU-12-31-38-07-19-4B ]# passwd myuser
———-
2. Login to the server as the user that you created now.
————–
[root@domU-12-31-38-07-19-4B ]# su myuser
[myuser@domU-12-31-38-07-19-4B root]$
————–
3. Execute vncpasswd. It will create .vnc directory for the user. This file contains the startup script of VNC for this user.
————-
[myuser@domU-12-31-38-07-19-4B root]$ vncpasswd
————-
4. Now, logout from the user( Ctrl +D) and login as a root. Then, add the following line in the file /etc/sysconfig/vncservers. This will give the VNC access to the user.
——————–
VNCSERVERS=”1:myuser”VNCSERVERARGS[1]=”-geometry 640×480″
——————–
If you want to access the root content then execute the command "vncpasswd" in root and
add the following content in /etc/sysconfig/vncservers.
-------------
VNCSERVERS="1:myuser 2:root"VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 640x480"-------------
5. The final step is to start the vnsserver service.
-------------
[root@domU-12-31-38-07-19-4B root]$/sbin/service vncserver start
-------------
You can use the "ps -ef " command to check what are the ports are used by the VNC, what is the
user doocument root.
-------------
[root@domU-12-31-38-07-19-4B ~]# ps -ef |grep vnchris 1636 1 3 Dec07 ? 00:10:14 /bin/sh /home/myuser/.vnc/xstartupchris 7308 1 0 01:33 ? 00:00:01 /usr/bin/Xvnc :1 -desktop domU-12-31-38-07-19-4B:1 (chris) -auth /home/myuser/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /home/chris/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pnchris 7356 7352 0 01:33 ? 00:00:00 vncconfig -iconicroot 7411 1 0 01:33 pts/0 00:00:00 /usr/bin/Xvnc :2 -desktop domU-12-31-38-07-19-4B:2 (root) -auth /root/.Xauthority -geometry 1200x1000 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pnroot 7497 7495 0 01:33 pts/0 00:00:00 vncconfig -iconicroot 12665 18731 0 03:54 pts/0 00:00:00 grep vn[root@domU-12-31-38-07-19-4B ~]#-------------
The VNC uses the port range from 59xx. So, these ports should be open in the server firewall
and as well as harware firewall(if any).
Verification:
1. You can access the VNC in the browser by using the public IP address of the server. It will
prompt for user name and password. After entering password, you will able to connect to the server
as GUI interface. Please note that Java support should be enabled in the browser for accessing the
VNC.
--------
http://182.173.23.13:5901
--------