Virtualization: Hands On

Get your hands dirty with Virtualization:- used KVM to provide virtulization

The step-by-step process for doing the same is as follows:-
11.)    Have 2 systems ready: 1st is Server with Linux OS (CentOs or Redhat), 2nd is Client with Linux or Windows OS.

22.)    Both the systems should be in a network (connected over LAN) and IPs (of same network) should be set for both the systems.

33.)    Set ip of server to 192.168.1.253 and of client to 192.168.1.2

44.)    Configure yum (used for installing packages with dependencies) for installing packages:
a.)    Put repo files in /etc/yum.repos.d/ directory. Repo files contain the source of the packages.
b.)    Edit the repo file to add our own package sources i.e. CD or Pendrive.



55.)    Setup virtualization on Server:
a.)    Open the terminal to run shell commands
b.)    Install qemu-kvm by using: yum install kvm
c.)    Install virt-manager (Graphical tool to manage virtual machines) by using: yum install virt-manager
d.)    Install libvirt using: yum install libvirt
e.)    Start libvirt service: service libvirtd start
f.)      Open virt-manager
g.)    Click on new to add new virtual machine
h.)    Install a virtual machine by following the steps in the virt-manager wizard. After installation following screen will appear:



i.)      To access this virtual machine remotely we have to configure qemu. By default qemu listens on loopback interface (127.0.0.1), to allow this to listen on public interface we have to change the qemu  configuration file ie /etc/libvirt/qemu.conf. (Appendix: 1)






j.)      Open the file and uncomment the vnc_listen parameter and replace 127.0.0.1 with your server ip, e.x vnc_listen=”192.168.1.253” as shown in the following sample snapshot



                                         
k.)    Once a virtual machine is setup a configuration file is created for each virtual machine in /etc/libvirt/qemu/ directory with the name of the virtual machine.
l.)      Edit this VM Configuration file to allow the vnc access of this vm, we can also add password to stop unauthorized access to the virtual machine as shown below: (Appendix: 2)



m.)  Now our virtual machine is ready to be accessed remotely, just we need to know on which port qemu is listening, to know that just run the following command:                 virsh vncdisplay <virtual_machine_name> as shown in the following snapshot:


66.)    Setup client side to access the virtual machine:
a.)    Configure yum same way as done with the server.
b.)    Install vnc using: yum install tigervnc
c.)    Open vncviewer










d.)   Just connect by providing the ip of server and port no on which virtual machine is running, example:




e.)    Enter the vnc password to authenticate yourself:











f.)     If the Entered password is correct you will get the login screen of the virtual machine as follows:


g.)    Now use the server resources remotely as shown below:



This eventually provides Infrastructure as a Service. Infrastructure as a service comes with many benefits. Some of these are: 
1. the ease of scaling the infrastructure up and down, 
2. high reduction to initial investment, 
3. not to worry about the management of the System (backup, networking etc),
4. can focus on the core business. 
5. One of the main advantages is that it is environment friendly. The servers require a lot of power to run. When using Iaas a Single server provides many virtual servers, this helps in reduction of physical resources and thereby there is a gross reduction in power consumption. The user is free from changing the system configuration as frequently as he wishes. 

This is the manual procedure and a base to virtualization, this need further automation and easier handling, we will discuss these in later post.

No comments:

Post a Comment