Linux Beginner-Virtual Machine Management Chapter

Source: Internet
Author: User
Tags first string

Linux Beginner-Virtual machine Management Chapter

As has been described before, in the Linux system learning, generally need to operate in the virtual machine, but how to install the virtual machine? How is it managed? A brief introduction to the installation and management of virtual machines is provided below.

1, the installation of virtual machines

The virtual machine needs to enter the command "Virt-manager" to open the virtual machine management interface as shown in the installation. To create a new virtual machine you need to right click on the "name" row of the virtual machine and select "New". Then select Install mode because the ISO image file is local, so choose Install from Local:

Click "ForWord" to pop up the following screen, this interface is to select the installation source, in the "Use ISO image" column to select the installation source is the ISO image file.

Click "ForWord" after the following interface, this interface select the memory size and CPU core number, here Select Memory is 1024, the number of cores is 1.

Click "ForWord" to pop up the following screen, this interface set the size of the hard disk, here set to 8G.

After clicking "ForWord", the following screen appears, enter the virtual machine name.

After the above steps are set, click "Finsh" to enter the virtual machine installed interface. As shown in.

Entry will be entered into the Select System language interface.

Clicking Continue will enter the options screen. This interface will configure the hard disk, pre-installed software and other information.

For the hard disk configuration, and the hard disk partition, respectively, divided into "/boot", "swap", "/".

The selection interface for preinstalled software.

After you choose to start the installation, you will enter the following screen. You can set the Super user password and the normal user password in this interface.

The setup virtual machine installation steps above are slightly more complex, or you can use a script to complete this step, as shown in the installation script.

"#!/bin/bash" indicates the specified command run environment.

"Virt-install \" indicates the installation of the virtual machine.

"--name $* \" means setting the name of the virtual machine.

"$*" means that the first string of characters followed when this script is run is the virtual machine name.

"--vcpus 1 \" indicates the number of cores for the CPU.

"--ram 1024 \" Indicates the size of the memory.

"--file/var/lib/libvirt/images/$*.qcow2 \" indicates the hard disk file location.

"--file-size 8 \" Indicates the hard disk file size.

"--cdrom/iso/rhel-server-7.2-x86_64-dvd.iso &" represents the designation of the installation source.

In the case of a network installation, you can set the local installation source to the network installation source location, such as Site http://172.25.254.2/rhel7.2 &. and select the hard disk, partition, etc. can also be omitted, to achieve automatic installation, specific methods in the PXE network installed in the article described.

2, the management of virtual machine

Most of the virtual machine management is implemented by "Virsh" plus some parameters. The parameters for virtual machine management are as follows:

"Virt-manager" can turn on the graphical management tool.

"Virt-viewer Vmname" can display the virtual machine, Vmname represents the virtual machine name, such as "we".

The Virsh list can list the virtual machines that are running.

"Virsh list--all" lists all virtual machines.

"Virsh start Vmname" runs the specified virtual machine.

"Virsh shutdown vmname" Gracefully shuts down the specified virtual machine.

"Virsh destroy Vmname" forcibly ends the specified virtual machine.

There are other parameters, such as "Virsh undefine vmname", which delete the front-end management of the VM, but do not delete the storage. "Virsh Create Vmname.xml", which represents the temporary recovery of the specified vm,vmname represents the front end management file. "Virsh define Vmname.xml" means to permanently restore the virtual machine.

3. Virtual Machine Snapshot

Virtual machine snapshots can replicate virtual machines and are useful when there is a problem with the virtual machine.

The command for a virtual machine snapshot is "qemu-img create-f qcow2-b vm2.qcow2 node1.qcow2", such as "Qemu-img create-f qcow2-b test.qcow2 node1.qcow2".

Can also be configured through "Virt-manger", as shown, and the new virtual machine is similar, but in the installation method below select the last one, select the snapshot source is "Test.qcow2", click Next to generate a virtual machine snapshot.

This can also be done naturally using snapshot scripts, as shown in the script, which runs the script and adds the snapshot virtual machine name and the virtual machine name of the snapshot to generate the snapshot.

These are the contents of the virtual machine installation and management.

Linux Beginner-Virtual Machine Management Chapter

Related Article

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.