VirtualBox是 Oracle 的一款流行的虚拟化软件,可用于 Linux、mac 和 Windows 系统。它是灵活的,并提供了许多功能来实现虚拟化。这是在 Windows 中体验 Ubuntu 而不安装它的最佳且简单的方法。然而,我强烈建议将 Ubuntu 以双引导的方式安装在物理机上,从而更好地体验 Ubuntu。
下面列出的步骤假设你是第一次在 Windows 中安装 Ubuntu。因此,这些步骤有点描述性,也有点冗长。此外,以下步骤适用于 Windows 10 和 Windows 11 作为宿主机。
你需要什么 可上网的 PC用于安装的 Ubuntu Linux ISO 镜像文件安装了 VirtualBox 的 Windows 系统使用 VirtualBox 在 Windows 上安装 Ubuntu下载并安装必要的东西从以下链接下载 Ubuntu Linux 桌面版 ISO 镜像文件。
此外,请从下面的官方网站下载 Oracle VirtualBox 安装程序。

Windows 中的 VirtualBox 需要 “Microsoft Visual C++ 2019 Redistrobutiable package”。你必须先安装它。从以下链接下载软件包(X64 架构):


完成以上安装后,从以下链接下载最新的 Python 包。Python 绑定也是 Windows 端 VirtualBox 安装所需的依赖项。
然后,启动 VirtualBox 安装程序并按照屏幕上的说明进行安装。
安装后,重新启动 Windows 系统。
为 Ubuntu 设置虚拟机从开始菜单启动 VirtualBox。

在 VirtualBox 窗口工具栏上,单击 “新建New”。

单击 “硬件Hardware” 部分,并调整虚拟机所需的内存。一般的经验是,虚拟机的内存大小应该小于主机系统中的物理内存。我建议对于 8 GB 内存系统的虚拟机使用 2 GB 到 4 GB。要选择 4 GB 内存,拖动滑块(或键入)使其为 4096 MB(即 4×1024)。选择 2 或 4 核处理器。
单击 “硬盘Hard Disk” 部分,并保持文件位置不变。为 Ubuntu 安装提供至少 20 GB 到 25 GB 的容量。硬盘文件类型值保持为 VDI(VirtualBox 磁盘镜像)不要选择 “预分配完整大小Pre-allocate Full Size”。最后,单击 “完成Finish”。
你应该在 VirtualBox 的左侧面板上看到一个新条目,其中包含一个 Ubuntu 22.04 条目(你之前设置的名称)。
选择条目并单击 “开始Start” 以引导到虚拟机:

成功引导后,你应该看到以下屏幕,其中显示了安装 Ubuntu 的各种选项。选择 “尝试 UbuntuTry Ubuntu” 或 “安装 UbuntuInstall Ubuntu”。
在欢迎屏幕中,单击 “尝试 UbuntuTry Ubuntu”。过了一会儿,你会看到下面的 Ubuntu 临场Live桌面。如果要更改分辨率,请右键单击桌面并选择显示设置。并将分辨率更改为 1400×900。

在桌面上,双击 “安装 UbuntuInstall Ubuntu”。

在下一组屏幕中,根据需要选择 “语言Language” 和 “键盘布局Keyboard Layout”。


安装屏幕为你提供所需的安装类型。选择 “正常安装Normal Installation”,然后在 “其他选项Other options” 下选择两个选项。

由于你是在虚拟磁盘空间中安装的,即它只是一个文件,因此你可以安全地选择 “擦除磁盘并安装 UbuntuErase disk and install Ubuntu” 选项。

点击 “立即安装Install Now” 并 “继续Continue”。

然后选择 “地区region”,添加“你的名字Your name”、“计算机名称Your computer's name”、“用户名Username” 和 “密码Password”。这将是安装后登录 Ubuntu 的用户 id 和密码。
单击 “继续Continue” 开始安装。等到它完成。

安装完成后,单击 “立即重新启动Restart Now”。等待几秒钟,你将看到一个登录屏幕。使用用户 id 和密码登录。你应该看到 Ubuntu 桌面在 Windows 端 VirtualBox 中作为 VM 运行。



成功安装后,应为 Windows 宿主机和 Ubuntu 客体机安装 “VirtualBox 客体机增强项VirtualBox guest additions”。客体机增强项是一组需要安装在客体虚拟机(即 Ubuntu)内的软件包,以启用 共享文件夹、双向复制 / 粘贴、自动更改分辨率和许多类似功能。
要安装它,请引导到 Ubuntu。从 VirtualBox 菜单中,选择“设备Devices > 插入客体机增强 CD 镜像Insert Guest Additions CD Image”。必要的软件包将安装在 Ubuntu 中。

打开文件管理器并打开装入的文件夹,如下所示。然后右键单击 > 选择 “在终端中打开open in terminal”。

然后运行以下命令:

完成上述命令后,重新启动 Ubuntu VM。
启用 Windows 和 Ubuntu 之间的复制和粘贴要在 Windows 和 Ubuntu 系统之间启用复制和粘贴,请从菜单中选择 “设备Devices > 共享剪贴板Shared Clipboard > 双向Bi-directional”。

理想情况下,你应该从自己的关机菜单中关闭 VM。但是,你也可以从 VirtualBox 主窗口关闭。右键单击虚拟机名称并选择 “关闭Close > 关机Poweroff”。

如果要完全删除虚拟机(例如 Ubuntu)及其数据,请选择 “删除Remove” 和 “删除所有文件Delete All Files”。


在本教程中,你学习了使用 VirtualBox 在 Windows(10 或 11)上安装 Ubuntu 的最简单方法。此外,你还学习了几步安装后配置 Ubuntu VM 的基本步骤。你可以对 VirtualBox 中的其他任何 Linux 发行版使用上述步骤。
如果你有任何疑问,欢迎在下面发表评论。
via: https://www.debugpoint.com/install-ubuntu-windows-virtualbox/
作者:Arindam选题:lkxed译者:ZhangZhanhaoxiang校对:wxy
本文由 LCTT原创编译,Linux中国荣誉推出