Virtual machine brings great convenience to work, not just in demand use of resources, and migration configuration is particularly convenient. This article will use the Ubuntu 14.04 Desktop version to create RedHat 64 Enterprise Server (RHEL64) virtual machine.
1 ready to install the CD-ROM image
2 Open the Virtual Machine Manager
Although you can create a virtual machine using the command line, but the principle of simple things simple to do, I use virt-manager to create a virtual machine. Open a terminal on Ubuntu, enter the following command to open Virtual Machine Manager (a virtual box of something similar, if not able to find this thing, it is apt-get install it):
$ Sudo virt-manager
3 start creating installation process
a. Press the button Create a new virtual machine, enter the name: RHEL64-origin
I like to create a clean virtual machine, use this as the source, then later used when cloned from this source. Usually I created this virtual machine, install jdk and gcc only two things. So I put the name of the machine is called the origin. Then press Forward.
b. In Use ISO image:Fill in your address column in the iso
c. The next step is then input memory size and number of CPU. These parameters can be adjusted after the virtual machine creation. At this point I enter 4096MB RAM and 2 CPU. Only then Host machine than physical memory / CPU and more can be.
d. Then the next step to create a disk image. At this point we need to be careful. You may need to consider future expansion. For example, here you specify a 128GB disk image, it will really create the 128GB of files on your hard disk. First you have to have such a large hard disk space for the image file. This is RAW image file formats, so it does not compress. So if we need to create 10 virtual machines how to do? To keep this problem to be solved. Assuming that the physical hard disk space is 700GB, we prepare future storage 10-20 virtual machines, each virtual machine hard disk space 128GB. At this point we can enter 128GB. Select Allocate entire disk now. Press Next. Then pop up a statistical report, do not ignore it, press Finish. Enter Redhat installation interface. This I will not say more.
e. all the way Next, confirm discard any data. When asked to enter the hostname, enter RHEL64-origin, press Configure Network, set eth0 network Connect automatically.
f. In Whick type of installion would you like? appears, select Create Custum Layout. That is their own partition. 128GB total partition:
1024MB --- / boot ---- Primary
8192MB --- swap
8192MB --- / tmp
16384MB --- / home
The rest is --- /
4 converting file formats
Virtual machine image file as follows:
This is the raw format, space = 128GB. Requiring into qcow2 format. Enter the directory RHEL64-origin.img, run the command:
$ Sudo qemu-img convert -O qcow2 RHEL64-origin.img RHEL64-origin.qcow2
It is generated only 2GB size RHEL64-origin.qcow2.
Then change the virtual machine configuration file:
$ Sudo vi /etc/libvirt/qemu/RHEL64-origin.xml
type = 'raw' => type = 'qcow2'
RHEL64-origin.img => RHEL64-origin.qcow2
The results are as follows:
< Disk type = 'file' device = 'disk'>
< Driver name = 'qemu' type = 'qcow2' />
< Source file = '/ var / lib / libvirt / images / RHEL64-origin.qcow2' />
< Target dev = 'vda' bus = 'virtio' />
< Address type = 'pci' domain = '0x0000' bus = '0x00' slot = '0x05' function = '0x0' />
< / Disk>
$ Sudo virsh define RHEL64-origin.xml
$ Sudo virsh list --all
$ Sudo virsh start RHEL64-origin
Adding to the host machine ip and hostname mapping, accelerate virtual machine ssh login speed:
#vi / etc / hosts
$ Ssh @ rehl64-org
Log into the virtual machine:
[Root @ RHEL64-origin ~] # df -h
Filesystem Size Used Avail Use% Mounted on
/ Dev / vda6 94G 1.8G 87G 2% /
tmpfs 1.9G 0 1.9G 0% / dev / shm
/ Dev / vda1 1008M 60M 898M 7% / boot
/ Dev / vda2 16G 172M 15G 2% / home
/ Dev / vda3 7.9G 146M 7.4G 2% / tmp
[Root @ RHEL64-origin ~] #
success. You can delete the file:
$ Sudo rm -fr /var/lib/libvirt/images/RHEL64-origin.img
From October 2012 began to be written now, it has been more than a year and a half. If the full over here and practice, a lot can be harvested. Then prepare to enter a deeper level in the field of cloud computing: software-defined networking. Because we created a large number of virtual machines, and how these false machine consisting of a large network. Most of the time we choose bridge (bridge), which allows the virtual machine and the host on a network, so that virtual machines can be used as a host of the network. If NAT way, each host is one subnet, each virtual machine within the host machine are interoperable within the subnet. NAT way, between different virtual machine host can not visit each other, they need to form a network gateway.
Software-defined network-related technology can solve these problems. With definable network infrastructure with virtual machines, physical machines underlying cloud formed, together constitute the infrastructure of IaaS. Then is the Hadoop various cloud platform software as the core. As to the cloud development and deployment of business specific code is relatively simpler.