Linux Operations Essentials unit15

Source: Internet
Author: User
Tags first string


15. System Virtual Machine Management


1. Installation

#!/bin/bash # #命令运行环境的指定

virt-install \ # #安装虚拟机

--name \ # #虚拟机名称指定, representing the first string of characters after the script

--ram # #内存

--file/var/lib/libvirt/images/$1.img \ # #硬盘文件

--file-size 8 \ # #硬盘文件大小

--cdrom/var/ftp/pub/iso/rhel-server-7.1-x86_64-dvd.iso & # #安装源指定

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/92/03/wKiom1j6Hlbz97YsAAAgQAzDncw411.jpg-wh_500x0-wm_ 3-wmp_4-s_652781289.jpg "title=" 36020170421225129184.jpg "alt=" Wkiom1j6hlbz97ysaaagqazdncw411.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/92/02/wKioL1j6HqKyE9afAAAUwfVJzTs959.jpg-wh_500x0-wm_ 3-wmp_4-s_3428639841.jpg "title=" 36020170421225203618.jpg "alt=" Wkiol1j6hqkye9afaaauwfvjzts959.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/92/03/wKiom1j6Hwuh3cVRAAFv4Bv2hlY949.jpg-wh_500x0-wm_ 3-wmp_4-s_2887776671.jpg "style=" Float:none; "title=" 36020170421225212573.jpg "alt=" Wkiom1j6hwuh3cvraafv4bv2hly949.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/92/02/wKioL1j6HwyAiZIKAADC80UsP_M678.jpg-wh_500x0-wm_ 3-wmp_4-s_2324285569.jpg "style=" Float:none; "title=" 36020170421225221485.jpg "alt=" wkiol1j6hwyaizikaadc80usp_ M678.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/92/02/wKioL1j6HwzR6PtwAACamyIcfS8026.jpg-wh_500x0-wm_ 3-wmp_4-s_2325733550.jpg "style=" Float:none; "title=" 36020170421225229283.jpg "alt=" Wkiol1j6hwzr6ptwaacamyicfs8026.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/92/03/wKiom1j6Hw3jgvlYAAC4LnrBeP4442.jpg-wh_500x0-wm_ 3-wmp_4-s_977597989.jpg "style=" Float:none; "title=" 36020170421225235230.jpg "alt=" Wkiom1j6hw3jgvlyaac4lnrbep4442.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/92/03/wKiom1j6Hw2yawD4AACZiIt3pjE539.jpg-wh_500x0-wm_ 3-wmp_4-s_636429537.jpg "style=" Float:none; "title=" 36020170421225240783.jpg "alt=" Wkiom1j6hw2yawd4aacziit3pje539.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/92/02/wKioL1j6Hw6Ahc6IAAB9k12WbZk335.jpg-wh_500x0-wm_ 3-wmp_4-s_1737638449.jpg "style=" Float:none; "title=" 36020170421225250601.jpg "alt=" Wkiol1j6hw6ahc6iaab9k12wbzk335.jpg-wh_50 "/>

2. Management

Virt-manager # #开启图形管理工具

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/92/02/wKioL1j6HrXx5CZwAAAbV34IGIY269.jpg-wh_500x0-wm_ 3-wmp_4-s_2984143241.jpg "title=" 36020170421225155955.jpg "alt=" Wkiol1j6hrxx5czwaaabv34igiy269.jpg-wh_50 "/>

Virt-viewer Vmname # #显示虚拟机, Vmname represents the virtual machine name

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/92/03/wKiom1j6H1qTQsQbAACPk-o0zwc885.jpg-wh_500x0-wm_ 3-wmp_4-s_872031291.jpg "title=" 36020170421225302931.jpg "alt=" Wkiom1j6h1qtqsqbaacpk-o0zwc885.jpg-wh_50 "/>

Virsh List # #列出正在运行的vm

Virsh list--all # #列出所有vm

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/92/02/wKioL1j6H3yQibMjAABCxoDqioA224.jpg-wh_500x0-wm_ 3-wmp_4-s_2963382587.jpg "title=" 36020170421225339686.jpg "alt=" Wkiol1j6h3yqibmjaabcxodqioa224.jpg-wh_50 "/>

Virsh start Vmname # #运行指定vm

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/92/02/wKioL1j6H5Oi0XfnAAAXvDMKpYY640.jpg-wh_500x0-wm_ 3-wmp_4-s_2793490604.jpg "title=" 36020170421225634201.jpg "alt=" Wkiol1j6h5oi0xfnaaaxvdmkpyy640.jpg-wh_50 "/>

Virsh shutdown Vmname # #正常关闭指定vm

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/92/03/wKiom1j6H6XQ_bwZAAATvUwbWWg865.jpg-wh_500x0-wm_ 3-wmp_4-s_1701111945.jpg "title=" 36020170421225638465.jpg "alt=" Wkiom1j6h6xq_bwzaaatvuwbwwg865.jpg-wh_50 "/>

Virsh Destroy Vmname # #强行结束指定vm

Virsh Create Vmname.xml # #临时恢复指定vm, Vmname represents the front-end management file

Virsh define Vmname.xml # #永久恢复vm

Virsh undefine vmname # #删除vm的前端管理, storage is not deleted

3. Virtual Machine Snapshots

Qemu-img create-f qcow2-b Vm2.qcow2 node1.qcow2

!/bin/bash

Virsh Destroy $ &>/dev/null

Virsh undefine $ &>/dev/null

Qemu-img create-f qcow2-b/var/lib/libvirt/images/$1.qcow2/var/lib/libvirt/images/$2.qcow2 &>/dev/null

Virt-install \

--name

--ram 1000 \

--DISK/VAR/LIB/LIBVIRT/IMAGES/$2.QCOW2 \

--import &>/dev/null &

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/92/02/wKioL1j6H-rDps-gAAAsY7X2UJA595.jpg-wh_500x0-wm_ 3-wmp_4-s_2405701295.jpg "title=" 36020170421225700385.jpg "alt=" Wkiol1j6h-rdps-gaaasy7x2uja595.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/92/03/wKiom1j6IAiDUFH4AAAoOl2aso4071.jpg-wh_500x0-wm_ 3-wmp_4-s_3217598747.jpg "title=" 36020170421225704980.jpg "alt=" Wkiom1j6iaidufh4aaaool2aso4071.jpg-wh_50 "/>


Linux Operations Essentials unit15

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.