Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of kvm Environment Construction under centos6.5

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the example analysis of kvm environment building under centos6.5. I hope you will get something after reading this article. Let's discuss it together.

First, shut down some services and turn off the kernel firewall (need to restart the machine)

Chkconfig postfix off

Chkconfig iptables off

Chkconfig ip6tables off

Chkconfig NetworkManager off

Sed-I's Universe GH'/ etc/selinux/config

Second, verify virtualization support

[root@kvm ~] # cat / proc/cpuinfo | grep 'vmx'-- color=auto # verify whether Intel CPU supports full virtualization

[root@kvm ~] # cat / proc/cpuinfo | grep 'svm'-- color=auto # verify whether AMD CPU supports full virtualization

Install and update kvm-related packages and load modules

[root@kvm ~] # yum install-y kvm virt-* libvirts bridge-utils qemu-img

[root@kvm ~] # yum upgrade device-mapper-libs

[root@kvm ~] # modprobe kvm-intel # load kvm module. When the execution is successful, no feedback will be given.

[root@kvm ~] # lsmod | grep kvm # check whether the kvm module is loaded

Kvm_intel 54285 0

Kvm 333172 1 kvm_intel

Fourth, the network card eth0, br0 related configuration

[root@kvm network-scripts] # cat ifcfg-eth0

DEVICE=eth0

HWADDR=00:0c:29:77:95:8e

TYPE=Ethernet

UUID=29ab4ff0-e2ed-4132-ac07-8e5bbd472ff5

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

BRIDGE=br0

[root@kvm network-scripts] # cat ifcfg-br0

DEVICE=br0

TYPE=Bridge

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=static

IPADDR=192.168.1.100

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

DNS1=202.102.224.68

[root@kvm network-scripts] # service network restart

5. Modify / etc/libvirt/qemu.conf

Echo 'vnc_listen = "0.0.0.0" > / etc/libvirt/qemu.conf

Restart libvirtd and messagebus services

[root@kvm libvirt] # / etc/init.d/libvirtd restart

Stopping libvirtd daemon: [FAILED]

Starting libvirtd daemon: [OK]

[root@kvm libvirt] # / etc/init.d/messagebus restart

Stopping system message bus: [OK]

Starting system message bus: [OK]

[root@kvm libvirt] #

[root@kvm libvirt] # mkdir / iso # create an image file directory

[root@kvm libvirt] # mkdir-p / data/kvmdisk/ # create a virtual disk storage directory

= upload the ISO file to the iso directory through WinSCP software = not explained in this article =

Create a virtual machine

[root@localhost] # virt-install-n win08-r 4096-vcpus=4-s 80-c / iso/win2008.iso-- hvm-- os-type=windows-f / data/kvmdisk/win2008.img--

Graphics vnc,listen=0.0.0.0,port=7789-force-autostart

/ / Command explanation:

Create a virtual machine called win08 with 4 gigabytes of memory and 4 cpu,80G hard disks. The installation image is / iso/win2008.iso designated as full virtualization, and the system type is windows.

For / data/kvmdisk/win2008.img, and configure the port of vnc to 7789 to start installation automatically

Virt-install parameter description:

-n-- name= virtual machine name

-r-memory allocated by the ram= virtual machine

-u-- uuid of the uuid= virtual machine

-vcpus=2 specifies the number of 2 vcpu

-v-hvm all virtual him

-p-- paravirt paravirtualization

-l-- location=localdir installation source

-- vnc uses vnc

/ / you can use "--graphics vnc,listen=LISTEN,..."

-- vncport specifies the vnc monitoring port. The default port is 5900. The port cannot be reused.

-- vnclisten specifies vnc binding ip

-c-cdrom= CD-ROM drive or installation path

-s-the size of the disk image used by file-size= in GB

-f-- the file used by file= as a disk image

-- disk= uses different options as disk to use installation media

-- force prevents interactive prompts

-- os-variant specifies the operating system type

-- accelerate acceleration

-- network network type. Default is used here, and bridge bridge is generally used.

Centos installation: virt-install-n Centos6.5-r 4096-vcpus=4-s 80-c / iso/CentOS65.iso-- hvm-- os-type=linux-f / data/kvmdisk/centos65.img-- graphics

Vnc,listen=0.0.0.0,port=7789-force-autostart

After reading this article, I believe you have some understanding of "sample Analysis of kvm Environment under centos6.5". If you want to know more about it, please follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report