Search This Blog

Friday, September 7, 2012

How to configure VNC Server in RHEL6 ?

Disable nm controlled network management.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT="no"
HWADDR=00:0C:29:AA:10:3D
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.30
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no


Disable firewall using

system-config-firewall-tui

Disable selinux

[root@canada ~]# getenforce

Enforcing


vi /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 


Restart System

init 6



ifup eth0

Network Configuration
vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

192.168.1.30  canada canada

ifdown eth0
ifup eth0


Install vncserver

yum install *vnc*

Configure it.

Uncomment the highlighted section & also provide a valid username.

vi /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:root"
 VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

Provide password for vncserver.

[root@canada Desktop]# vncpasswd
Password:
Verify:


Restart vncserver.
[root@canada Desktop]# service vncserver restart
Shutting down VNC server:                                  [  OK  ]
Starting VNC server: 2:root xauth:  creating new authority file /root/.Xauthority

New 'canada:2 (root)' desktop is canada:2

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/canada:2.log

                                                           [  OK  ]



[root@canada Desktop]# vncserver -kill :2
[root@canada Desktop]# chkconfig vncserver on
[root@canada Desktop]# chkconfig vncserver --list
vncserver       0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@canada Desktop]# vncserver :99

New 'canada:99 (root)' desktop is canada:99

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/canada:99.log


Now connect through vncviewer

192.168.1.30:99

and for password use what you had give for passwd command.


1 comment: