如何(以及为何)在 Windows 11 上运行 Ubuntu 应用程序

PHPz
发布: 2024-06-19 03:44:02
原创
1034 人浏览过

您知道使用 Ubuntu 独有的应用程序不需要覆盖您的操作系统吗?通过在 Windows 11 上使用 Ubuntu 应用程序来释放 Windows 桌面的真正潜力,通过融合 Linux 和 Windows 的强大功能来增强您的 PC 体验。

为什么在 Windows 11 上使用 Ubuntu 应用程序?

将 Ubuntu 添加到 Windows 11 可以访问仅在 Windows 上无法使用的各种免费应用程序。这些也不仅仅是普通的程序;它们几乎可以在您的计算机上完成任何任务,从增强文件管理到创意项目。例如,如果您正在寻找 Windows 11 上找不到的出色照片管理工具,您可以尝试使用 Shotwell 和 WSL。或者,如果您不喜欢 Windows 上提供的电子邮件应用程序,您可以安装 Ubuntu 原生 Geary 电子邮件客户端。有许多很棒的 Ubuntu 专属应用程序可以提升您的 Windows PC 水平。

此外,如果您喜欢手工制作和编码,那么 Windows 和 Ubuntu 的组合会让您受益匪浅。它简化了面向 Linux 的项目的工作流程,而无需离开 Windows 环境。无论您的追求是为了享受编码还是构建重要项目,这种集成都可以减少复杂性并提高生产力。

假设您是一名从事跨平台项目的开发人员。在 Windows 上使用 Ubuntu 应用程序意味着您可以在 Linux 和 Windows 上轻松快速有效地测试您的新项目。相信我:我用 Go 编程语言编写程序,能够测试我的代码并在 Ubuntu 和 Windows 11 上无缝运行它是非常强大的。

开始之前的要求

在 Windows 11 系统上开始使用 Ubuntu 之前,必须满足一些要求以确保过程顺利进行。在我的测试过程中,直到我安装了 Windows 11 上安装的最新 WSL2 内核软件包后,WSL 才会工作。如果您像我一样在 Windows 11 上运行 WSL 时遇到问题,请安装此内核软件包。它将确保 WSL v2 操作系统正确运行。您可以直接从 Microsoft 下载并安装 EXE 文件。

除了 WSL2 Kernel EXE 包之外,您还需要在 Windows 11 的“Windows 功能”区域中启用“虚拟机平台”功能。WSL 借助虚拟化来运行,并且此功能是在 Windows 11 中充分利用 Ubuntu 的必要条件。

最后,确保您拥有 Windows 11 系统的管理员权限。使用 WSL 需要修改 Windows 功能,如果没有管理员权限则无法使用。

启用适用于 Linux 的 Windows 子系统 (WSL)

Windows 11 上默认不启用适用于 Linux 的 Windows 子系统。您需要在 Windows 上激活此功能,然后才能使用它来运行Windows PC 上的 Ubuntu 应用程序。

首先,打开桌面上的 Windows 开始菜单。打开后,在搜索框中输入“打开或关闭 Windows 功能”。启动其下方标有“控制面板”的图标,以访问 Windows 11 的“添加/删除功能”区域。

在“Windows 功能”窗口中,向下滚动并找到“适用于 Linux 的 Windows 子系统”。找到它后,单击它旁边的空白框即可激活此功能。做出选择后选择“确定”。

How (and Why) to Run Ubuntu Apps on Windows 11

现在已选择“确定”按钮,Windows 11 将开始在您的系统上设置 WSL。此设置过程应该需要几分钟才能完成。设置完成后,您必须重新启动 Windows PC。选择“立即重新启动”按钮重新启动。

重新启动后,重新登录 Windows 11 桌面。重新登录后,将在 Windows 11 上启用适用于 Linux 的 Windows 子系统。

安装 Ubuntu

Ubuntu for WSL 可通过 Microsoft Store 适用于 Windows 11,从而可以进行安装在系统上安装 Ubuntu 以在 Windows 11 中运行 Linux 应用程序。

要启动 Ubuntu for WSL 的安装,请从 Windows 11 桌面打开 Microsoft Store。打开后,找到“搜索应用程序、游戏、电影等”框并单击它。

在搜索框中输入“Ubuntu”。进入“Ubuntu”后,Microsoft Store 将显示 Ubuntu 应用程序的各个版本。使用鼠标选择“Ubuntu 22.04.3 LTS”。

How (and Why) to Run Ubuntu Apps on Windows 11

选择“Ubuntu 22.04.3 LTS”后,您将被引导至 Microsoft Store 中的功能页面。找到“获取”按钮并单击它。选择“获取”按钮将启动 Windows 11 的 Ubuntu 下载。

在 Windows 11 上下载 Ubuntu 22.04.3 LTS 应该很快,因为该程序的大小仅为约 560 MB。下载完成后,即可在 Windows 开始菜单中访问 Ubuntu。

Ubuntu 22.04.3 LTS 在 Windows 11 上完成安装后,访问 Windows 开始菜单,搜索“Ubuntu 22.04.3 LTS”并启动它。首次启动时,Ubuntu 将自动进行自我配置并准备使用。

How (and Why) to Run Ubuntu Apps on Windows 11

Ubuntu 在 Windows 11 上完成设置后,您将看到一个空的终端窗口,准备好与 Windows 11 系统上的 Ubuntu 进行交互。

基本配置提示

以下是一些用于改善 Windows 11 上的 WSL 体验的基本配置提示。

Windows 和 Linux 文件系统集成

Windows 和Linux 文件系统集成简化了 Ubuntu WSL 设置和 Windows 11 桌面之间的文件移动。以下是如何利用此功能。

要从 Windows 11 访问 Ubuntu 文件,请首先打开 Windows 资源管理器。打开后,在侧边栏中找到“Linux”企鹅图标并选择它。

选择“Linux”后,将出现一个名为“Ubuntu-22.04”的文件夹。右键单击该文件夹并选择“固定到快速访问”。此操作使您可以轻松地从 Windows 访问您的 Ubuntu 文件。

How (and Why) to Run Ubuntu Apps on Windows 11

要从 Ubuntu 访问 Windows 文件,请使用 cd 命令导航到 /mnt/c 文件夹。此方法提供与 Windows 11 C:/ 驱动器的交互。

cd /mnt/c
登录后复制

更新您的 Ubuntu WSL 应用程序

不时更新您的 Ubuntu WSL 应用程序是一个很好的做法,否则程序将停止工作。以下是在 Windows 11 上执行此操作的方法。

首先,从 Windows 开始菜单打开 Ubuntu 应用程序。打开后,运行 apt update 命令来检查 Ubuntu 软件更新。

sudo apt update
登录后复制

检查完更新后,可以使用 apt Upgrade 命令来安装它们。

sudo apt upgrade
登录后复制
How (and Why) to Run Ubuntu Apps on Windows 11

启动和使用 Ubuntu

Windows 11 中的 Ubuntu 有一个带有 WSL 的终端界面。 WSL 是一个可直接从 Windows 访问的 Linux 系统层,而不是 Windows 桌面之上的 Linux 桌面。

使用 Ubuntu 意味着安装要在 Windows 11 上使用的软件包。要启动 Ubuntu,请在 Windows 开始菜单中搜索“Ubuntu 22.04.3 LTS”。打开后即可使用。

从这里,您可以安装任何您喜欢的应用程序。要在 Windows 11 系统上安装 Ubuntu 应用程序,请首先搜索应用程序的名称。您可以使用 apt search 命令进行搜索。例如,要查找“wireshark”,请执行以下操作:

apt search wireshark
登录后复制

在搜索结果中查找您要安装的程序。然后,使用“apt install programname”命令。例如,要安装 Wireshark,则为:

sudo apt install wireshark
登录后复制

安装程序后,您可以使用以下命令直接从终端启动它:

nohup program_name & disown
登录后复制
How (and Why) to Run Ubuntu Apps on Windows 11

或者,可以从 Windows 11 开始菜单启动应用程序。

与 Windows 11 集成

通过 WSL 安装应用程序时,它们可以通过将自身安装到 Windows 11 开始菜单中来很好地集成到 Windows 11 中。要从 Windows 11 访问已安装的 WSL 程序,请查看您的程序。每个集成的应用程序都会有一个 Linux 图标。

WSL 与 Windows 11 的集成非常好。但是,请记住,并非每个应用程序都会创建桌面图标。有时,您可能需要直接从终端启动 Ubuntu 程序。通常,您可以通过键入其包名称并按 Enter 键来完成此操作。

Troubleshooting Common Setup Issues

WSL usually installs without a hitch on Windows 11. However, if you're having issues, there is a quick and easy fix. First, open up PowerShell in Windows 11. Once it is open, use the update command for WSL. Updating WSL will install various patches and fixes that are sure to alleviate the issues you're experiencing.

wsl --update
登录后复制

Alternatively, if updating doesn't help, consider re-installing Ubuntu WSL again by following the installation instructions in the "Setup" portion of this guide.


WSL upgrades your Windows 11 experience by bringing Ubuntu apps to your desktop without the hassle of virtualization. Jump into Ubuntu and WSL to enhance the power of your Windows 11 PC and discover new possibilities in computing.

以上是如何(以及为何)在 Windows 11 上运行 Ubuntu 应用程序的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:howtogeek.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!