In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The kvm virtualization solution provides two sets of virtual machine template management tools.
One is kvm's own qemu components, including qemu-kvm,qemu-img,qemu-io, etc.
The other is virsh, a general open source management tool.
Today we will first introduce the creation of virtual machine templates using qemu components, and then we will use the qemu tool to create examples of centos7.0 and windows server 2008 virtual machine templates.
Preparation of the basic environment
Install a Centos version 7.0 virtual machine on vmware
Pay attention to turn on the virtualization feature of CPU
To install the operating system, when selecting the dependency package, install all the installation packages required for virtualization according to the diagram.
Note: if your virtual machine is installed in the default environment, you need to manually install KVM virtualization management tools
Yum install-y qemu-kvm libvirt libvirt-client libvirt-python virt-manager virt-viewer
After the installation is complete, use rpm-ql qemu-kvm to see if the qemu-kvm executable is in the / usr/bin directory, if no link file has been created for environment variable calls.
Ln-sv / usr/libexec/qemu-kvm / usr/bin
Log in to verify after the basic environment is installed
Use egrep-- color=auto "(svm | vmx)" / proc/cpuinfo to see if the virtualization function of the system is turned on
The CPU of AMD is svm
After we have created the virtual machine, the default virtual machine runs in the isolated network model, similar to the host-only mode of vmware. If you need to communicate with external hosts, you also need to define the model of the network as bridging or nat model.
The virtual network cards of all created virtual machines are mounted under this bridge to communicate with external hosts.
Let's start to create a Centos7.0 virtual machine template image to copy the iso file of Centos7.0 under the / tmp directory and use the qemu-img tool to create a disk storage space qemu-img create-o size=20G for the template. Preallocation=metadata-f qcow2 / tmp/centos7.img create a 20g qcow2 storage disk in sparse format. Later we will install the image file in this storage space, qemu-kvm-name "centos7.0"-m 512-smp 2-boot d-drive file=/tmp/centso7.img,if=virtio,media=disk,format=qcow2-drive file=/tmp/CentOS-7.0-1406Muzuki x86q64muri DVD.isotropic cdrom-net nic. Model=virtio parameter details:-name centos7.0: the process of creating the virtual machine specifies a name-m: specify the memory size-smp: specify the number of CPU cores-boot: specify the boot startup item N: boot from the network, c: boot from the CD drive, d: boot from the disk-drive: specify the disk image file, you can use the advanced format media: disk file type format: disk format-net: specify the first half of the network, that is, the virtual network card in the virtual machine template
Open a new terminal and enter vncviewer: 5900
Start the installation
Log in to the system after installation and use the lsmod command to view the driver
Shut down the virtual machine, and the virtual machine template is finished.
Just copy out the file and upload it to the cloud platform.
Windows server 2008 image template creation first creates a 20g storage disk qemu-img create / tmp/wondows2008.img-o size=20G,preallocation=metadata-f qcow2 loads the iso file to create a virtual machine qemu-kvm-name wondows2008-m 512-smp 2-boot d-drive file=/tmp/windows2008.img,if=virtio,index=0,media=disk,format=qcow2-driver file=/tmp/cn_windows_server_2008.iso,index=1,media=cdrom-drive file=/tmp/virtio-win-1.7.4.iso Media=cdrom Note: if you want windows's virtual machine template to support paravirtualization, you must load the vortio driver. Window's official website provides a mirror package in iso format, which can be downloaded from the official website. After running the create virtual machine command, open the vnc console
Note that when you choose to install the disk, you will be prompted that the driver cannot be loaded, so we need to go to virtio to load it manually.
Click load driver, and then click Browse
Select the driver of the corresponding windows version in virtio, where the virtio driver is the-dirve file=/tmp/virtio-win-1.7.4.iso we specified on the command line.
Click next to install
After the installation is complete, enter the windows2008 operating system and open the device manager. Check to see if the driver is installed properly. If there is an exclamation point, you need to update the driver. Driver management automatically scans virtio for driver updates.
After shutting down the virtual machine, turn on the virtual machine again for verification
Qemu-kvm-name "windows08"-m 1024-smp 2-boot d-drive file=/tmp/windows2008.img,if=virtio,index=0,media=disk,format=qcow2 note that you no longer need to specify the iso file of wimdows and the virtio driver file at this time.
When the image file of windows2008 is finished, copy the windows2008.img file under / tmp/ directory and upload it to the cloud platform.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.