CentOS 6.5 sets up a KVM Server Platform

Source: Internet
Author: User

CentOS 6.5 sets up a KVM Server Platform

1. What is virtualization?
Virtualization Technology virtualizes a computer into multiple logical computers. Different operating systems can be installed on each logic computer. These systems are independent of each other and do not interfere with each other.
2. What Virtual Machine
A Software Platform runs operating systems and applications on a physical machine.
3. Mainstream virtualization Products
VMware
Micosoft
Citrix

RedHat

4. KVM network settings
NAT mode (default)
Select NAT as the nic of the kvm virtual machine. The Gateway points to the Intranet 192.168.1.1 of the HOST, and then it can directly access the internet.
Routing mode (HOST enables routing and forwarding)
The HOST acts as a router. the gateway of the Guest HOST points to the ip address of the NIC connected to the HOST. data packets can be sent to the Internet. However, if the Internet HOST responds to data packets, it must have a route to the network of the Guest HOST.
Isolation Mode
All hosts connected to the isolated vswitch can communicate with each other, but cannot access the external network.
Bridging Mode
The Guest HOST and HOST are connected to the same vswitch. As long as the IP address is in the same CIDR block, all the hosts in the network of the Guest HOST and HOST can communicate directly.

Lab (1)

Objective: To build a KVM Server Platform Based on CentOS 6.5

Lab environment:
KVM virtual server, real machine or high-end Virtual Machine (memory> 4 GB)
Host Name: fxhlj
Partition example:
/Boot 200 MB, SWAP 8 GB,/100 GB,
/Data 30 GB (logical volume/data/vg_data/lv_data)
Operating System: CentOS 6.5 ==> disable iptables firewall, disable SELinux mechanism, and enter the graphic desktop
==> Disable the NetworkManager service

Prerequisites for installing KVM in the experiment:
First, the CPU must support Virtualization (Intel is vmx and AMD is svm)
Make sure that VT is enabled in BIOS
Intel (R) Virtualization technology [Enabled]

Install KVM virtualization-related software and enable services

1. Check whether YUM is available

2. view the software package group (change the language to English)

3. install the software package

4. Start the service

5. Call the graphic interface

Operate on a real machine (the following interface is displayed after you enter this command)

Experiment (2)

Objective: to configure the HOST network and storage

Add virbr1 isolation Interface

1. "Virtual System Manager" --> "edit" --> "Connection Details"
.... Click "+ .... Network1 .... 192.168.4.0/24
Do not enable the built-in DHCP of KVM.
!!!! Avoid conflicts with virtual NICs of VMware Workstation

The following page appears (Click Virtual Network) and click the + number below

Click forward

Add network name network1 and press forward

Select a network segment for the virtual network, which is in the same network segment as your PXE environment. If it is not in the same network segment, it cannot be installed. press forward.

By default, DHCP is not enabled to avoid the impact of virtual NICs on VMware Workstation.

Create an isolated network

Click Finish.

View the created network information.

2. Confirm the newly added virtual network card

3. Create a bridge Nic br0 (no bridge by default, You need to manually create it)

4. Prepare Virtual Machine disks (prepare storage space for the virtual machine ).

Requirements: 1. Create a New 28 GB partition on the KVM Server

2. format it and mount it as/data

3. Use dd to create a 10 Gb Virtual Disk File

View Disk Partitions

Partitioning a disk

Create a logical partition of 28 GB

Create the/data directory, mount the logical partition to this directory, and automatically mount the partition as it starts.

Create a directory named images under/data/to store virtual machines, and create a file named 10 Gb under the images directory to store the first virtual machine.

Lab (3)

Objective: To install an operating system for a virtual machine through PXE.

Open the Virtual System Manager

Create a VM

Because I only use 1 GB memory for the virtual machine, I chose MB memory.

Select an isolated network and click Finish.

An error occurs when the PXE system is installed. solution (DHCP cannot obtain the IP address): restart the DHCP service.

If the error is displayed, the tftp file cannot be loaded, the network is changed to a virtual isolated network, and the KS file content, such as partition information, can be adjusted.

You can directly install the system by clicking the self-edited menu.

Select to load the Startup File and Kernel File after installing the system, as shown in ).

After the PXE environment is installed, the system automatically checks the required kernel files and boot files.

Note: (1. check the content of your KS file, especially whether the hard disk is consistent with the hard disk you provide to the virtual machine, if they are inconsistent, change the size of the KS file's hard disk to be consistent with that of the virtual machine you have given. 2. Check whether the KS file in the/var/lib/tftpboot/pxelinux. cfg/default file is the required KS file ).

Experiment (4)

Objective: To avoid password input in Host OS ssh Guest OS
Management machine (Private Key) --> KVM server (Public Key)

1. Create an SSH key pair on the physical machine and deploy the Public Key File

2. Upload the generated public key to the VM and set 192.168.1.30 as the VM.

3. Test

Create an alias goa = "ssh-X root@192.168.1.30" on the Physical Machine"

Directly on the physical machine, you can use goa to directly access the virtual machine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.