Archive for category Cloud Computing General

kvm virtualization under Oracle Linux 6 or CentOS 6 (Clone of Redhat Linux 6)

Recently, I got around to installing Oracle Linux 6 (RHEL 6 clone) on a machine in order to experiment with kvm. The machine I installed it on is an Intel Core 2 Duo 6400 with 4 GB of RAM. Intel Virtualization Technology (VT) is present in this chip, and enabled in the BIOS. I am running the server headless.

At install time, I chose the ‘virtual host’ option.


Setting up a bridge ‘br0’ in order to enable VM bridged networking:

Oracle Linux installs a default bridge virbr0 that is useful if you want to configure the VM to use ‘host only’ networking. I wanted a bridged network VM, i.e. the VM’s virtual interface should appear on my physical network just as any other machine would. There are a few steps that I need to do in order to enable this:

  • Create a new bridge ‘br0’ and assign it the static IP address that used to be associated with eth0.
  • Make the physical network interface ‘eth0’ be an uplink port to this bridge ‘br0’.

The assumption here is that the physical network card in the system is ‘eth0’. If you have ‘eth1’ connected to the network, make the corresponding changes to the setup described. Another assumption here is that at the end of the Linux install, ‘eth0’ has the static IP address 192.168.1.201/24 with gateway 192.168.1.10.

First create a new file /etc/sysconfig/network-scripts/ifcfg-br0 with the following contents:

DEVICE="br0"
TYPE=Bridge
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=static
IPADDR=192.168.1.201
NETMASK=255.255.255.0
GATEWAY=192.168.1.10

Next, delete the old ifcfg-eth0 file, and create a new one with the following contents:

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT="yes"
BRIDGE=br0

Setup /etc/resolv.conf to point to the free google DNS Servers:

nameserver 8.8.8.8
nameserver 8.8.4.4

Reboot the system. When it comes up again,  the bridge br0 should have the IP address, and eth0 should be an uplink port on the bridge, as shown below:

br0       Link encap:Ethernet  HWaddr 00:1C:C0:07:20:70
inet addr:192.168.1.201  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::21c:c0ff:fe07:2070/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:69422 errors:0 dropped:0 overruns:0 frame:0
TX packets:38962 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8360996 (7.9 MiB)  TX bytes:9988797 (9.5 MiB)

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:07:20:70
inet6 addr: fe80::21c:c0ff:fe07:2070/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:69433 errors:0 dropped:0 overruns:0 frame:0
TX packets:39489 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9335186 (8.9 MiB)  TX bytes:10020863 (9.5 MiB)
Memory:e0400000-e0420000

Setting up yum to use a disk based copy of the install DVD as its repository:

After installation, I copied the contents of the install DVD into a directory called /root/cdrom. Then I ran the command ‘createrepo .’ from the /root/cdrom directory. Note that I had to do a ‘rpm –install’ of the createrepo rpm before I could do this. I also created a file /etc/yum.repos.d/iso.repo with the following contents:

[iso_repository]
baseurl=file:///root/cdrom
enabled=1

One more step:

I ran the following on Oracle Linux:

# rpm --import /root/cdrom/RPM-GPG-KEY

I ran the following on CentOS 6:

# rpm --import /root/cdrom/RPM-GPG-KEY-CentOS-6

Now, yum can find rpms from the /root/cdrom directory.


Starting to install RHEL6 in a newly created blank VM using the libvirt command line tool virt-install:

First, I turned off the firewall using ‘/etc/init.d/iptables stop’, since I want to connect to the guest console using vncviewer from my desktop. Remember, this server is running headless.

# mkdir -p /vms/1

# virt-install --name=el6guest --arch=x86_64 --ram=512 --os-type=linux --os-variant=rhel6 --hvm --network bridge=br0 --cdrom=/dev/cdrom --disk path=/vms/1/vdisk0,size=16 --accelerate --vnc --vnclisten=0.0.0.0

Starting install...
Creating storage file vdisk0                                                                          |  16 GB     00:00
Creating domain...                                                                                    |    0 B     00:00
Cannot open display:
Run 'virt-viewer --help' to see a full list of available command line options
Domain installation still in progress. You can reconnect to
the console to complete the installation process.

Connecting to the console of the newly created VM in order to start installation:

The VM el6guest has now been created by virt-install, but we dont yet know which vnc port the guest is listening on. Run the command virsh as follows:

[root@localhost ~]# virsh vncdisplay el6guest
:0

The ‘:0’ printed out by virsh tells us that the vnc server for guest el6guest is listening on port 5900, i.e. display 0

Startup the vncviewer binary on your desktop, and connect to the VM server at display 0. The Oracle Linux installer console will come up in vncviewer.

I installed a base server with root password el6guest. Once installation is complete, hit restart. The VM will shutdown at this point. You can restart the VM from virsh as shown below:

[root@localhost qemu]# virsh
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
'quit' to quit
virsh # start el6guest
Domain el6guest started
virsh # vncdisplay el6guest
:0

Now, you can connect to display 0 using a vncviewer from your desktop, and the VM’s console will show up. That’s all folks..


, , , , ,

Leave a comment

Cloud Computing Overview

Till a few years ago, if you wanted to run something on the Internet, either to provide service to the public, or to your own employees, you would do one of the following:

  1. Your own in-house Datacenter: You put your servers in your data closet, bought a T1 or T3 link from your telco, and published a DNS name for your service (chat.mycompany.com, for example)
  2. You could rent a full/half/quarter rack from a co-location facility such as Exodus of the past. Load up your own servers, install your server OS, install your Applications, install your firewall etc. and run your service

The principal reasons for renting space in a colo rack were:

  • Good electricty (Dual power sources + UPS, for example)
  • Good network connectivity (fiber connection to Sprint, ATT and other backbone networks)
  • Higher bandwidth for a lower price ( T1 is 1.544Mbps to your own data closer and may cost you $500/month, versus a $350 10Mbps link at the colo with capacity to burst upto 100Mbps for at most 5% of the time)

Setting up and getting going in a colo was, and continues to be a pain. It could involve a multi year contract, and some upfront setup charges.
Fast forward to today, and the colo scenario has been replaced by Cloud computing. Cloud computing consists of the following different types:

  1. Infrastructure As A Service (IaaS) – rent virtual machines from the Cloud Service Provider, and run (almost) any software (OS + Apps) on it
    • Example: Amazon EC2. Smallest VM is 8.5cents an hour ($744.60/year)
  2. Platform As A Service (PaaS) – rent capacity on An Application Platform to run your application. You do not get to choose the OS or hardware, and the application environment is usually very restricted. Google App Engine, for instance, requires you to write brand new applications in a language called Python
    • Example: Salesforce’s force.com and google’s Google App Engine
  3. Software As A Service(SaaS) – you rent an application. You do not get to choose hardware, the Operating System, or the Application. You just buy ‘functionality’.
    • Example: WebEx. You purchase the capability to run web conferencing.

All of the three cloud compute options bring about an ease of use and low barrier to entry for customers that is an astounding improvement over the colo scenario of years past. Billing by the hour of use, pioneered by Amazon’s EC2 service, makes it very easy for customers to try out software, and develop on the cloud.

Advances in Cloud compute technologies are encouraging people to outsource their own datacenter and its operations to the Cloud. One step in this migration may be to run Cloud compute software in your own datacenter, and then move suitable applications to the public cloud.

, , , ,

Leave a comment