How to configure VNC in Oracle Virtual Server – Part 7


In my last post, new VM has been built and started, now how can we install the operating system and other application on that host from Command Line Interface.
This can be achieved by enable the VNC (Virtual Network Computing) settings in Virtual Machine configuration to access from remote host.

Step 1: Login to Oracle Virtual Server.

[root@mgmtsrv ~]# ssh ovs01.lab.local
root@ovs01.lab.local's password:
Last login: Sat Dec 23 05:24:55 2017 from 10.10.10.1
Warning: making manual modifications in the management domain
might cause inconsistencies between Oracle VM Manager and the server.

Step 2: Check the VM console port number.

[root@ovs01 ~]# xm list
Name ID Mem VCPUs State Time(s)
0004fb0000060000524f9d3e43fd71f3 1 515 1 ------ 1.5
Domain-0 0 814 4 r----- 89.9

[root@ovs01 ~]# xm list -l | grep location
(location 5)
(location 127.0.0.1:5900)

[root@ovs01 ~]# netstat -antulp | grep 5900
tcp 0 0 127.0.0.1:5900 0.0.0.0:* LISTEN 2537/qemu-dm

If you see above netstat output, the console port 5900 mapped to localhost. Which means that VM can be accessible only from local Oracle VM Server, we can’t connect the VM host from remote machine. But in next step we are going to define the vnclisten address to overcome this problem.

Go to Virtual Machine configuration path.

[root@ovs01 ~]# cd /OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3

Add the below vfb parameter to enable the VNC to access from anywhere.

[root@ovs01 0004fb0000060000524f9d3e43fd71f3]# echo "vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=hello123']" >> vm.cfg

[root@ovs01 0004fb0000060000524f9d3e43fd71f3]# cat vm.cfg | grep vfb
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=hello123']

vnc = 1 # vnc=1 enabled, 0=disabled
vncconsole = 1 # vncconsole=1 enables spawning VNC viewer for domain’s console. Default=0
vnclisten = 0.0.0.0 # sets VNC to allow access to any computer
vncpasswd = ‘hello123’ # VNC password
vncunused = 1 # vncunused=1 – find an unused port for the VNC server to listen on. Default=1

Step 3: Access VM host from Oracle VM Manager.

Install Required Packages in Oracle VM Manager

[root@ovm ~]# yum install -y xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps

Enable X11 SSH Forwarding in the /etc/ssh/ssh_config file.

Uncomment or add the below lines.

X11Forwarding yes

Restart SSH Service

[root@ovm ~]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

Download and install Xming

Once you installed Xming, Select Xming and click XLaunch and proceed with default parameters.

Configure Putty

1. Open Putty and Enter the OVM server hostname or ipaddress
2. Go to Connection -> SSH -> X11 -> Enable X11 forwarding checkbox
3. Set the X display location as localhost:10.0
4. Finally click Open button
5. Login as root user

[root@ovm ~]# echo $DISPLAY
localhost:10.0

By executing below command we can make sure X11 options enabled on this machine.

[root@ovm ~]# xclock
[root@ovm ~]# xeyes

Connect to the guest on the host computer with the command

[root@ovm ~]# vncviewer -Shared ovs01.lab.local:5900

TigerVNC Viewer for X version 1.1.0 - built Sep 22 2014 07:14:05
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.

Sun Dec 17 06:21:36 2017
CConn: connected to host ovs01.lab.local port 5900
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8

Sun Dec 17 06:21:39 2017
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding

That’s it. Now you can able to access the VM host and start installing the Operating System.

Connect Linux machine from Windows desktop


xrdp is an Open Source Remote desktop Protocol server, which allows you to RDP to your Linux server from Windows machine.

Step 1: Install EPEL repository

For 32 bit OS

[root@server ~]# yum install http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

For 64 bit OS

[root@server ~]# yum install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Step 2: xrdp Installation

[root@server ~]# yum install xrdp

After installation, start the xrdp daemon

[root@server ~]# /etc/init.d/xrdp start
[root@server ~]# chkconfig --level 35 xrdp on

check xrdp is listening on 3389 port

[root@server ~]# netstat -antup | grep xrdp

Step 3: Connect from Windows machine

== Open run, type mstsc and hit enter

== RDC dialogue window will open, enter ip address of your linux machine in text box and click “Connect” button.

== Now you will be asked to enter your linux user name and password.

That’s it. You will see your linux graphical screen on your windows desktop.

VNC server configuration


The common method to manage a Linux server remotely is through CLI interface via SSH, which many people often find it difficult as they are not familar with the Linux commands.

The solution is to install a KDE Or GNOME Desktop on the Linux server and access it through VNC.

VNC (Virtual Network Computing) is a graphical desktop sharing system which allows you to share a desktop of a remote server as if you are sitting in front of it.

Below are the two required packages needed for VNCserver

vnc-4.1.2-14.el5_6.6
vnc-server-4.1.2-14.el5_6.6

Following are the steps to install and configure VNC on a Linux server.

Step 1: Check whether the vnc-server packages are installed on machine.

[root@server.local ~]#rpm -qa vnc*

If not, please install the vnc packages,

[root@server.local ~]#yum install vnc*

Step 2: Set the vnc server password

[root@server.local ~]#vncpasswd
Password:
Verify:

Step 3: Start the VNC server

[root@server.local ~]# vncserver
xauth: creating new authority file /home/root/.Xauthority

New 'server.local.transmarkmail.com:1 (root)' desktop is server.local.transmarkmail.com:1

Creating default startup script /home/root/.vnc/xstartup
Starting applications specified in /home/root/.vnc/xstartup
Log file is /home/root/.vnc/server.local.transmarkmail.com:1.log

Step 4: Edit the configuration file

[root@server.local ~]# vi .vnc/xstartup

Uncomment the following two lines (remove the “#” characters):

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Save that file and you’re ready to move on.

Step 5: Now, download and install VNC-Viewer on your computer (client-side).

Open vnc-viewer and enter “server.hostname:1? (server.local.transmarkmail.com:1) and the vnc password you have set above. You will now be connected to the graphical interface of your Linux server.

Step 6: To kill the vnc server session

[root@server.local ~]# vncserver -kill :1
Killing Xvnc process ID 1353