1. Lab description
Qcow2 disk format is recommended for KVM virtual machines in centos 7. In this tutorial, centos 6.8 64 virtual machines are installed in KVM.
2. Command deployment process 2.1 upload an image
Use winscp to upload to/data/ISO/
2.2 format a disk
1 virt-install --network bridge=br0,model=virtio --name=vm01-centos6.8 --ram=1024 --vcpus=2 --disk path=/data/images/vm01-centos6.8.img,size=20,bus=virtio --cdrom /data/iso/CentOS-6.8-x86_64-bin-DVD1.iso --vnc --vncport=5902 --vnclisten=0.0.0.0 --noautoconsole --accelerate
Parameter description:
-- Name: Specifies the Virtual Machine name.
-- Ram: memory size allocated.
-- Vcpus: Number of CPU cores allocated. The maximum number of CPU cores is the same as that of the physical machine.
-- Disk: Specifies the virtual machine image and size specifies the allocation size in G.
-- Network: indicates the network type. The default network type is used here. Generally, the bridge type is used.
-- Accelerate: acceleration
-- CDROM: Specifies the installation image ISO.
-- VNC: enables VNC remote management. Generally, it must be enabled for installation systems.
-- Vncport: Specifies the VNC monitoring port. The default port is 5900, and the port cannot be repeated.
-- Vnclisten: Specify the IP address bound to the VNC. 127.0.0.1 is bound by default. Here, it is changed to 0.0.0.0.
-- OS-type = Linux, Windows: common operating system types.
-- OS-variant =
Win7: microsoftwindows7
Vista: microsoftwindowsvista
Winxp64: microsoftwindowsxp (x86_64)
WINXP: microsoftwindowsxp
Win2k8: microsoftwindowsserver2008
Win2k3: microsoftwindowsserver2003
Freebsd8: freebsd8.x
Generic: Generic
Debiansqueeze: debiansqueeze
Debianlenny: debianlenny
Fedora16: fedora16
Fedora15: fedora15
Fedora14: fedora14
Mes5.1: mandrivaenterpriseserver5.1andlater
Mandriva2010: mandrivalinux2010andlater
Rhel6: redhatenterpriselinux6
Rhel5.4: redhatenterpriselinux5.4orlater
RHEL4: redhatenterpriselinux4
Sles11: suselinuxenterpriseserver11
Sles10: suselinuxenterpriseserver
Ubuntuoneiric: ubuntu11.10 (oneiricocelot)
Tunatty: ubuntu11.04 (nattynarwhal)
Tumaverick: ubuntu10.10 (maverickmeerkat)
Ubuntulucid: ubuntu10.04 (lucidlynx)
Ubuntuhard: ubuntu8.04lts (hardyheron)
2.3 KVM Virtual Machine Installation
1 [[email protected] qemu]# virt-manager
Installation Process
3. log on to VM 3.1 and start VM.
1 [[email protected] ~]# virsh list --all 2 Id Name State 3 ---------------------------------------------------- 4 - vm01-centos6.8 shut off 5 [[email protected] ~]# virsh start vm01-centos6.8
3.1 Virtual Machine Manager login
In the graphic interface, use virt-manager to log on from the graphic interface.
3.2 command line Logon
1 [[email protected] ~]# virsh console vm01-centos6.8
4. Other notes: 4.1 kvm vm Network
It is possible that only the lo Nic is available after the kvm vm is logged on, but the eth0.
Run --
1 VI/etc/sysconfig/network-scripts/ifcfg-eth0 2 device = eth0 3 hwaddr = 52: 54: 00: CD: 4E: 34 # It must be globally unique with the KVM xml configuration file. 4 onboot = yes # Start 5 nm_controlled = Yes 6 bootproto = DHCP 7 prompt: If DHCP exists in the LAN, you can configure a static IP address in the same network segment as the host. 8 # ifconfig eth0 up 9 # dhclient eth0 # enable eth0 Nic.
4.2 failure in console connection to KVM VM
If the problem persists, You need to modify the relevant files in the KMV virtual machine. You can solve this problem in centos7 KVM virtual machine in the following ways --
1 [[email protected] ~] # Grubby -- Update-kernel = all -- ARGs = "console = ttys0" 2 centos6 can be solved through the following methods -- 3 [[email protected] ~] # Echo ssys0>/etc/securetty # host machine/etc/securetty add ttys0 4 [[email protected] ~] # Echo "S0: 12345: respawn:/sbin/agetty/ttys0 115200">/etc/inittab 5 [[email protected] ~] # Vi/etc/grub. conf 6 kernel/vmlinuz-2.6.32-431.el6.x86_64 Ro root =/dev/mapper/VolGroup-lv_root ...... Rhgb quiet console = ttys0 # Add console = ttys0
003. KVM Virtual Machine deployment-centos6.8