mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-10 00:00:29 +08:00
120 lines
5.4 KiB
Markdown
120 lines
5.4 KiB
Markdown
[#]: subject: "Share Folder Between Guest and Host in GNOME Boxes"
|
||
[#]: via: "https://www.debugpoint.com/share-folder-gnome-boxes/"
|
||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||
[#]: collector: "lkxed"
|
||
[#]: translator: "geekpi"
|
||
[#]: reviewer: " "
|
||
[#]: publisher: " "
|
||
[#]: url: " "
|
||
|
||
在 GNOME Boxes 里的客户机和宿主机之间共享文件夹
|
||
======
|
||
|
||
**使用下面的步骤在 GNOME Boxes 应用中的宿主机和客户机之间共享一个文件夹**。
|
||
|
||
GNOME Boxes 是一个创建和管理虚拟机的前端应用。它主要与 GNOME 桌面兼容。然而,你可以在其他桌面环境中使用它,如 KDE Plasma 和其他环境。
|
||
|
||
在后端,它使用 QEMU、KVM 和 libvirt 技术,并提供一个易于使用的用户界面来管理多个虚拟机。
|
||
|
||
如果你想了解更多,你也可以参考关于 GNOME Boxes 创建虚拟机的[这些指南][1]。
|
||
|
||
在之前的文章中,我们已经解释了如何在 [virt-manager][2] 和 [VirtualBox][3] 中共享文件夹。而下面的步骤也解释了 GNOME Boxes 的情况。
|
||
|
||
### 如何在 GNOME Boxes 中共享文件夹和文件
|
||
|
||
GNOME Boxes 主要支持 [SPICE 协议][4]来实现远程访问、共享和许多虚拟化功能。SPICE 是虚拟化领域中最古老的开源包之一。
|
||
|
||
#### 1. 初始设置
|
||
|
||
- 首先,确保在**客户机系统中安装以下 spice 软件包**。
|
||
|
||
```
|
||
sudo apt install spice-vdagent spice-webdavd #for Ubuntu-based distros
|
||
sudo dnf install spice-vdagent spice-webdavd #Fedora, RHEL, etc
|
||
pacman -S --needed spice spice-gtk spice-protocol spice-vdagent #Arch Linux (optional)
|
||
```
|
||
|
||
- 在你安装完上述内容后,**重启**宿主机和客户机系统。
|
||
- 在宿主机系统中(对于 GNOME 桌面),打开设置,进入共享面板。
|
||
- 使用顶部的切换按钮**启用共享**。
|
||
- 然后,点击文件共享和**启用文件共享**。请确保启用网络。密码是可选的。如果你想为你的共享文件夹启用基于密码的认证,请启用它。
|
||
|
||
![在设置中启用共享][5]
|
||
|
||
![启用文件共享][6]
|
||
|
||
- 关闭设置窗口。
|
||
- 打开 GNOME Boxes。右键单击虚拟机并选择**偏好**。
|
||
- 在偏好设置窗口中点击**设备和共享**,并点击共享文件夹下的** [+] 按钮**。
|
||
- 在**本地文件夹下**:从你的宿主机中选择你想在客户机中访问的文件夹。
|
||
- **名称**:给予你想要的任何名称。这个名称将在客人的文件管理器中可见。
|
||
- 点击保存。
|
||
|
||
![在宿主机中添加一个共享文件夹][7]
|
||
|
||
#### 2. 为客户机设置
|
||
|
||
- 启动你的客户机虚拟机。
|
||
- 在客户机虚拟机内,打开文件管理器。如果你使用的是 GNOME 桌面,打开 Nautilus(即 Files)。
|
||
- 点击**其他位置**。你应该在“网络”下看到 “**Spice 客户端文件夹**”。
|
||
- 双击这个,你应该看到你的主机系统的文件夹内容。
|
||
- 有时,上述文件夹需要一些时间才能出现。如果它不可见,请等待 1 或 2 分钟。通过 `F5` 刷新文件管理器窗口。
|
||
|
||
![客户机中的 Spice 客户文件夹][8]
|
||
|
||
#### 3. 一些故障排除
|
||
|
||
- 此外,如果你看到以下错误,那么你需要手动访问该路径。
|
||
|
||
```
|
||
Unable to access location - HTTP Error: Could not connect: Connection refused
|
||
```
|
||
|
||
![访问 spice 客户端文件夹时出错][9]
|
||
|
||
- 在文件管理器中按下 `CTRL+L`,调出地址栏。在地址栏中,输入以下内容:
|
||
|
||
```
|
||
dav://localhost:9843
|
||
```
|
||
|
||
- 然后点击回车。然后你应该看到文件夹的内容。SPICE 服务器使用 `dav` 协议,它在 9843 端口连接客户机和宿主机。
|
||
|
||
![通过 dav 协议访问][10]
|
||
|
||
就这样了。现在你可以在 GNOME Boxes 中享受客户机和宿主机之间的文件共享。
|
||
|
||
下面是一个客户机和宿主机访问同一个文件夹的截图。
|
||
|
||
![在 GNOME Boxes 中在客户机和宿主机之间共享文件夹及其内容(示例)][11]
|
||
|
||
如果你遇到任何错误,请在下方发表评论。
|
||
|
||
[_这篇文章中使用了一些来自 GitLab 的参考资料。_][12]
|
||
|
||
--------------------------------------------------------------------------------
|
||
|
||
via: https://www.debugpoint.com/share-folder-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.debugpoint.com/tag/boxes
|
||
[2]: https://www.debugpoint.com/share-folder-virt-manager/
|
||
[3]: https://www.debugpoint.com/share-folder-between-host-guest-virtualbox/
|
||
[4]: https://www.spice-space.org/index.html
|
||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-sharing-in-settings.jpg
|
||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-File-Sharing.jpg
|
||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Add-a-share-folder-in-host.jpg
|
||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Spice-client-folder-in-guest.jpg
|
||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/error-while-accessing-the-spice-client-folder.jpg
|
||
[10]: https://www.debugpoint.com/wp-content/uploads/2023/01/accessing-via-dav-protocol.jpg
|
||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Share-folder-and-its-contents-between-guest-and-host-in-GNOME-Boxes-sample.jpg
|
||
[12]: https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/430
|