translated

This commit is contained in:
geekpi 2023-06-26 09:07:33 +08:00
parent e00feab421
commit 2941290fda
2 changed files with 157 additions and 157 deletions

View File

@ -1,157 +0,0 @@
[#]: subject: "How to Install and Use GNOME Boxes to Create Virtual Machines"
[#]: via: "https://www.debugpoint.com/install-use-gnome-boxes/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install and Use GNOME Boxes to Create Virtual Machines
======
This quick tutorial explains the steps to install and use GNOME Boxes and create virtual machines, with some tips and troubleshooting.
Virtualization is the process of running a virtual instance (rather than an actual one) with an abstracted layer of hardware. In popular terms, it allows you to install and run multiple operating systems (Linux, Windows) simultaneously.
A [Virtual machine][1] is a simulated operating system that runs on top of another operating system and uses the same hardware, and storage space as the host machine. Although, you can control how much shared-memory or space can be allocated to virtual machines.
There are multiple software available to create virtual machines, e.g. [Virtual Box][2], KVM, Hyper-V, VM Ware player, and GNOME Boxes.
But honestly, most of them are complex to use and sometimes not stable enough. [GNOME Boxes][3] is another free and open-source software that is very easy to use and makes it simple for you to create, and manage virtual machines by abstracting lots of options.
### Install GNOME Boxes
If you are running Fedora with GNOME Spin, you should already have it installed. However, for Ubuntu, Linux Mint, Kubuntu, and other distributions, you can simply run below to install it in your system.
```
sudo apt install gnome-boxes
```
#### Via Flatpak
It is also available via the Flatpak package. I would recommend you to use this version. First, set up your system to use Flatpak using [this guide][4], and then run the following command from the terminal to install.
```
flatpak install flathub org.gnome.Boxes
```
### Create Virtual Machine using GNOME Boxes
* Launch GNOME Boxes from the application menu.
* To create a virtual machine, you need an image (*.ISO) of the operating system you want to virtualize.
* You can download any operating system iso images from the official download page of the distributions. For this guide, I am using Pop! OS, which is an excellent Linux distribution.
* After you launch, click on the “+” icon at the top to start and select “Create a virtual machine”.
![Create Virtual Machine][5]
In the next window, you can choose already available downloads, or you can select your iso file as OS source. Click on the “Operating system image file” and choose your iso file.
Assign the memory and storage space of your virtual machine. Remember, your virtual machine would take the memory and storage from your host system. So try not to assign as max.
For example, in the below image I have assigned 2GB memory for the virtual machine (guest) from the total 8GB memory of the host system.
Similarly, choose minimum storage space as well if you want to just test any OS. But if you are creating a virtual machine for servers or serious work, be logical in how much space or memory you want to assign.
Another important thing to remember is that the storage disk space which you allow will be blocked permanently unless you delete the virtual machine. So, you wont get that much of disk space as free even if your virtual machine doesnt use the entire allocated space.
![Allocate resources for your virtual machine][6]
Continue with the installation.
In the partition window, you should see one hard disk and partition, which is the virtual machine disk space. Usually, they are named as `/dev/vda` or `/dev/sda`.
Dont worry; you can play around with this partition, which will not impact your physical disk partitions or any data on your actual host system. Follow the same /root partition while installing Linux, and continue.
![Virtual machine partition][7]
After you complete the installation, you should be seeing your new operating system in the virtual machine. In the GNOME Boxes, you should see an entry to the system. You can click once to boot your virtual machine.
You can power off the virtual machine by using your virtual machine operating systems internal shutdown option.
If you want, you can also delete the virtual machine by choosing the context menu option.
![Context menu in installed virtual machine][8]
You can also check how much memory, and CPU your virtual machine uses from the properties window.
Note that you can adjust the memory and other items of your existing virtual machines using properties.
![System properties][9]
### Troubleshooting
Here are some of the common errors or issues which you may face while using GNOME Boxes.
##### 1. Resolution problems in virtual machines
If your virtual machine is having low resolution, which is incompatible with your host system, then you have to install the below items. Open up the terminal in the guest system (not in the host system) and run the below commands.
**For Ubuntu-based distributions**
```
sudo apt install spice-vdagent spice-webdavd
```
**For Fedora**
```
sudo dnf install spice-vdagent spice-webdavd
```
These two packages help to determine proper resolutions, copy/paste between host and guest, sharing files via public folders, etc.
Once installed, reboot the guest system; Or you can log off and re-login once after reboot, you should be seeing the proper resolution.
##### 2. GNOME Boxes dont start a virtual machine in Ubuntu 18.04 based distributions
If you are creating a virtual machine in Boxes 3.34 then you should know that there was a bug that caused your virtual machine to fail to start. To fix that you have to follow some additional steps. Remember these are not required for the latest Boxes 3.36.
Open a terminal window and run below command to change the qemu config file
```
sudo gedit /etc/modprobe.d/qemu-system-x86.conf
```
Add the below line in the above file and save.
```
group=kvm
```
Now, run below command to add your username to the KVM group.
```
sudo usermod -a -G kvm <your account name>
```
### Wrapping Up
In this article, you have see how to install and use GNOME Boxes to take advantage of virtualization. I hope it helps you.
🗨️ If you face any errors or have any questions with virtual machines with GNOME Boxes, let me know using the comment box below.
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/install-use-gnome-boxes/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.redhat.com/en/topics/virtualization/what-is-a-virtual-machine
[2]: https://www.debugpoint.com/tag/virtualbox/
[3]: https://wiki.gnome.org/Apps/Boxes
[4]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
[5]: https://www.debugpoint.com/wp-content/uploads/2020/05/Create-Virtual-Machine.png
[6]: https://www.debugpoint.com/wp-content/uploads/2020/05/Allocate-resources-for-your-virtual-machine.png
[7]: https://www.debugpoint.com/wp-content/uploads/2020/05/Virtual-machine-partition.png
[8]: https://www.debugpoint.com/wp-content/uploads/2020/05/Context-menu-in-installed-virtual-machine.png
[9]: https://www.debugpoint.com/wp-content/uploads/2020/05/System-properties.png

View File

@ -0,0 +1,157 @@
[#]: subject: "How to Install and Use GNOME Boxes to Create Virtual Machines"
[#]: via: "https://www.debugpoint.com/install-use-gnome-boxes/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
如何安装和使用 GNOME Boxes 来创建虚拟机
======
本快速教程解释了安装和使用 GNOME Boxes 以及创建虚拟机的步骤,以及一些提示和故障排除。
虚拟化是使用抽象硬件层运行虚拟实例而不是实际实例的过程。通俗地说它允许你同时安装和运行多个操作系统Linux、Windows
[虚拟机][1]是一个模拟操作系统,它运行在另一个操作系统之上,并使用与主机相同的硬件和存储空间。虽然,你可以控制可以分配给虚拟机的共享内存或空间量。
有多种软件可用于创建虚拟机,例如 [Virtual Box][2]、KVM、Hyper-V、VMWare player 和 GNOME Boxes。
但老实说,它们中的大多数使用起来都很复杂,有时还不够稳定。[GNOME Boxes][3] 是另一个免费的开源软件,它非常易于使用,通过抽象出大量选项让你可以轻松创建和管理虚拟机。
### 安装 GNOME Boxes
如果你正在运行 GNOME Spin 的 Fedora你应该已经安装了它。但是对于 Ubuntu、Linux Mint、Kubuntu 和其他发行版,你只需运行以下命令即可将其安装到你的系统中。
```
sudo apt install gnome-boxes
```
#### 通过 Flatpak
它也可以通过 Flatpak 包获得。我会推荐你使用这个版本。首先,使用[本指南][4]在系统中安装 Flatpak然后从终端运行以下命令进行安装。
```
flatpak install flathub org.gnome.Boxes
```
### 使用 GNOME Boxes 创建虚拟机
* 从应用菜单启动 GNOME Boxes。
* 要创建虚拟机,你需要要虚拟化的操作系统的镜像 (\*.ISO)。
* 你可以从发行版的官方下载页面下载任何操作系统 iso 映像。对于本指南,我使用的是 Pop! OS这是一个优秀的 Linux 发行版。
* 启动后,单击顶部的 “+” 图标启动并选择“创建虚拟机”。
![Create Virtual Machine][5]
在下一个窗口中,你可以选择已经可用的下载,或者你可以选择你的 iso 文件作为操作系统源。单击“操作系统镜像文件”并选择你的 iso 文件。
分配虚拟机的内存和存储空间。请记住,你的虚拟机将从主机系统获取内存和存储空间。所以尽量不要分配为最大值。
例如,在下图中,我从主机系统的总 8GB 内存中为虚拟机(客户机)分配了 2GB 内存。
同样,如果你只是想测试任何操作系统,也请选择最小存储空间。但是,如果你正在为服务器或严肃的工作创建虚拟机,请合理分配你要分配的空间或内存量。
另一件需要记住的重要事情是,除非你删除虚拟机,否则你允许的存储磁盘空间将被永久阻止。因此,即使你的虚拟机没有使用整个分配的空间,你也不会获得那么多的可用磁盘空间。
![Allocate resources for your virtual machine][6]
继续安装。
在分区窗口中,你应该看到一个硬盘和一个分区,这就是虚拟机的磁盘空间。通常,它们被命名为 `/dev/vda` 或者 `/dev/sda`
不用担心; 你可以随意使用此分区,这不会影响你的物理磁盘分区或实际主机系统上的任何数据。安装 Linux 时遵循相同的 /root 分区,然后继续。
![Virtual machine partition][7]
完成安装后,你应该会在虚拟机中看到新的操作系统。在 GNOME Boxes 中,你应该会看到一个系统条目。你可以单击它启动虚拟机。
你可以使用虚拟机操作系统的内部关闭选项关闭虚拟机。
如果需要,你还可以通过选择上下文菜单选项来删除虚拟机。
![Context menu in installed virtual machine][8]
你还可以从属性窗口检查你的虚拟机使用了多少内存和 CPU。
请注意,你可以使用属性调整现有虚拟机的内存和其他项目。
![System properties][9]
### 故障排除
以下是你在使用 GNOME Boxes 时可能遇到的一些常见错误或问题。
##### 1.虚拟机中的分辨率问题
如果你的虚拟机分辨率很低,这与你的主机系统不兼容,那么你必须安装以下项目。在客户系统(而不是主机系统)中打开终端并运行以下命令。
**对于基于 Ubuntu 的发行版**
```
sudo apt install spice-vdagent spice-webdavd
```
**对于 Fedora**
```
sudo dnf install spice-vdagent spice-webdavd
```
这两个包有助于确定合适的分辨率、在主机和客户之间复制/粘贴、通过公共文件夹共享文件等。
安装后,重新启动客户系统; 或者你可以在重启后注销并重新登录一次,你应该会看到正确的分辨率。
##### 2. GNOME Boxes 不会在基于 Ubuntu 18.04 的发行版中启动虚拟机
如果你在 Boxes 3.34 中创建虚拟机,那么你应该知道有一个错误导致你的虚拟机无法启动。要解决这个问题,你必须执行一些额外的步骤。请记住,最新的 Boxes 3.36 不需要这些。
打开终端窗口并运行以下命令来更改 qemu 配置文件:
```
sudo gedit /etc/modprobe.d/qemu-system-x86.conf
```
在上面的文件中添加以下行并保存。
```
group=kvm
```
现在,运行以下命令将你的用户名添加到 KVM 组。
```
sudo usermod -a -G kvm <你的帐户名称>
```
### 总结
在本文中,你了解了如何安装和使用 GNOME Boxes 来利用虚拟化。我希望它能帮助你。
🗨️ 如果你遇到任何错误或对 GNOME Boxes 的虚拟机有任何疑问,请使用下面的评论栏告诉我。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/install-use-gnome-boxes/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.redhat.com/en/topics/virtualization/what-is-a-virtual-machine
[2]: https://www.debugpoint.com/tag/virtualbox/
[3]: https://wiki.gnome.org/Apps/Boxes
[4]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
[5]: https://www.debugpoint.com/wp-content/uploads/2020/05/Create-Virtual-Machine.png
[6]: https://www.debugpoint.com/wp-content/uploads/2020/05/Allocate-resources-for-your-virtual-machine.png
[7]: https://www.debugpoint.com/wp-content/uploads/2020/05/Virtual-machine-partition.png
[8]: https://www.debugpoint.com/wp-content/uploads/2020/05/Context-menu-in-installed-virtual-machine.png
[9]: https://www.debugpoint.com/wp-content/uploads/2020/05/System-properties.png