sources/tech/20190913 An introduction to Virtual Machine Manager.md
6.4 KiB
An introduction to Virtual Machine Manager
Virt-manager provides a full range of options for spinning up virtual machines on Linux.
In my series about GNOME Boxes, I explained how Linux users can quickly spin up virtual machines on their desktop without much fuss. Boxes is ideal for creating virtual machines in a pinch when a simple configuration is all you need.
But if you need to configure more detail in your virtual machine, you need a tool that provides a full range of options for disks, network interface cards (NICs), and other hardware. This is where Virtual Machine Manager (virt-manager) comes in. If you don't see it in your applications menu, you can install it from your package manager or via the command line:
- On Fedora: sudo dnf install virt-manager
- On Ubuntu: sudo apt install virt-manager
Once it's installed, you can launch it from its application menu icon or from the command line by entering virt-manager.
To demonstrate how to create a virtual machine using virt-manager, I'll go through the steps to set one up for Red Hat Enterprise Linux 8.
To start, click File then New Virtual Machine. Virt-manager's developers have thoughtfully titled each step of the process (e.g., Step 1 of 5) to make it easy. Click Local install media and Forward.
On the next screen, browse to select the ISO file for the operating system you want to install. (My RHEL 8 image is located in my Downloads directory.) Virt-manager automatically detects the operating system.
In Step 3, you can specify the virtual machine's memory and CPU. The defaults are 1,024MB memory and one CPU.
I want to give RHEL ample room to run—and the hardware I'm using can accommodate it—so I'll increase them (respectively) to 4,096MB and two CPUs.
The next step configures storage for the virtual machine; the default setting is a 10GB disk image. (I'll keep this setting, but you can adjust it for your needs.) You can also choose an existing disk image or create one in a custom location.
Step 5 is the place to name your virtual machine and click Finish. This is equivalent to creating a virtual machine or a Box in GNOME Boxes. While it's technically the last step, you have several options (as you can see in the screenshot below). Since the advantage of virt-manager is the ability to customize a virtual machine, I'll check the box labeled Customize configuration before install before I click Finish.
Since I chose to customize the configuration, virt-manager opens a screen displaying a bunch of devices and settings. This is the fun part!
Here you have another chance to name the virtual machine. In the list on the left, you can view details on various aspects, such as CPU, memory, disks, controllers, and many other items. For example, I can click on CPUs to verify the change I made in Step 3.
I can also confirm the amount of memory I set.
When installing a VM to run as a server, I usually disable or remove its sound capability. To do so, select Sound and click Remove or right-click on Sound and choose Remove Hardware.
You can also add hardware with the Add Hardware button at the bottom. This brings up the Add New Virtual Hardware screen where you can add additional storage devices, memory, sound, etc. It's like having access to a very well-stocked (if virtual) computer hardware warehouse.
Once you are happy with your VM configuration, click Begin Installation, and the system will boot and begin installing your specified operating system from the ISO.
Once it completes, it reboots, and your new VM is ready for use.
Virtual Machine Manager is a powerful tool for desktop Linux users. It is open source and an excellent alternative to proprietary and closed virtualization products.
Learn how Vagrant and Ansible can be used to provision virtual machines for web development.
via: https://opensource.com/article/19/9/introduction-virtual-machine-manager
作者:Alan Formy-Duval 选题:lujun9972 译者:译者ID 校对:校对者ID