Linux Learning Note 7

Source: Internet
Author: User

Installation of virtual machines

Command mode

Virt-install \

--name \

--ram 1000 \

--FILE/VAR/LIB/LIBVIRT/IMAGES/$1.IMG \

--file-size 8 \

--cdrom/var/ftp/pub/iso/rhel-server-7.1-x86_64-dvd.iso

Script mode

Vim westos.sh

#!/bin/bash Environmental Development

Virt-install \ Installing virtual machines

--name \ Name

--ram 1000 \ Memory

--FILE/VAR/LIB/LIBVIRT/IMAGES/$1.IMG \ Hard Disk File

--file-size 8 \ Hard disk size

--cdrom/var/ftp/pub/iso/rhel-server-7.1-x86_64-dvd.iso developing the installation source

Managing Virtual Machines

Virt-manager Opening the Graphics management tool

Virt-viewer vmname Display virtual machines

Vrish List List of running virtual machines

Vrish list-all List all virtual machines

Vrish start Vmname Run the development VM

Virsh shutdown vmname normal shutdown VM

Virsh destroy Vmname forcibly end VM

Virsh Create vmname.xml temporarily restore VM

Virsh define Vmname.xml permanently recover VMS

Virsh undedine Vmname Deleting the front end of a VM does not delete storage

Setting up a Snapshot

Qemu-img create-f qcow2-b/var/lib/libvirt/images/vm1.qcow2/var/lib/libvirt/images/hello.qcow2

Resetting a snapshot with a script

Vim filename.sh

#!/bin/bash

echo Poweroff Hello
Virsh Destroy Hello &>/dev/null/close Snapshot
Echo del hello.xml ...
Virsh undefine Hello &>/dev/null/delete Snapshot
Echo Create Disk ...
Qemu-img create-f qcow2-b/var/lib/libvirt/images/vm1.qcow2/var/lib/libvirt/images/hello.qcow2/ Create a Snapshot
echo Create Hello vm ...
Virt-install \/Install virtual machine
--name Hello \/OK name
--ram 2000 \/Determine memory size
--DISK/VAR/LIB/LIBVIRT/IMAGES/HELLO.QCOW2 \/Specify hard drive location
--import &>/dev/null &/Start graphical interface


Linux Learning Note 7

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.