在虚拟机中运行 Linux 的十大优点

镜像下载、域名解析、时间同步请点击阿里云开源镜像站

你可以在虚拟机环境里运行任何操作系统,不论是测试还是为了某种需要。

对于 Linux 而言,它在虚拟环境下的性能会优于其他操作系统。即便你可能会犹豫是否在物理机(裸金属)上安装 Linux 系统,你仍然可以在虚拟机中安装一个性能几乎和物理机一样好的 Linux 系统。

当然,这并不意味着宿主系统为 Linux 时你就不能在虚拟机实例中安装 Linux了。

更何况,你在虚拟环境下使用 Linux 系统有许多好处。大致如下。

在虚拟环境下运行 Linux 之前的注意事项

在虚拟环境下运行 Linux 或许并不是艰巨的任务,但仍有以下几点你需谨记。

  • 虚拟机的性能取决于主机的性能如果您没有为该虚拟机分配足够的系统资源,则该虚拟机的使用体验必然不会很好。
    [En]

    the performance of the virtual machine depends on the performance of the host. If you do not have enough system resources allocated to the virtual machine, the use experience of the virtual machine is not bound to be very good.*

  • 部分功能仅在物理机(裸机)上生效,包括硬件加速和显卡(显卡)驱动。
    [En]

    some features take effect only on physical machines (bare metal), including hardware acceleration and graphics (graphics) drivers.*

  • 密集的磁盘 I/O 任务性能会十分受限,例如游戏测试场景。
  • 用户的 Linux 虚拟机实例体验会根据你所使用的虚拟化程序而发生变化,这些虚拟化程序包括 VMware、VirtualBox、GNOME Boxes 以及 Hyper-V 。

此外,你应当列出你的需求,并根据这些需求选定适当的虚拟化程序来运行你的 Linux 实例。

十条在虚拟环境中运行 Linux 的优点

尽管运行虚拟化 Linux 实例极具吸引力,你仍然应当首先考虑当前使用的宿主系统中已有的选择。例如,如果你不需要图形化桌面,或许利用 Windows 操作系统中​ 的 WSL 安装 Linux 就 ​可以满足你的需求。

一旦您决定使用虚拟机,这些优势将伴随您而来:

[En]

Once you have decided to use a virtual machine, these advantages will accompany you:

1、部署简便

在虚拟机中运行 Linux 的十大优点

部署简便

与在传统物理机(裸金属)上安装 Linux 相比,在虚拟机中部署一般会容易许多。

对于基于 Ubuntu 的发行版而言,像 VMware这样的虚拟化程序会提供一个 快速安装 的选项,你仅需输入用户名和密码,其余过程将自动完成而无需其他操作。你无需手动设置分区、引导程序以及更多高级设置。

在某些情况下,一些发行版的开发人员还会为特定的虚拟机提供预先构建的映像,只需打开它们即可使用。它就像一个可移植的虚拟机映像,可以随时使用。

[En]

In some cases, developers of some distributions will also provide prebuilt images for specific virtual machines, which can be used simply by opening them. It’s like a portable virtual machine image that can be used out of the box at any time.

例如,在这里你将看到如何在虚拟机中安装 Arch Linux 发行版。

对于其他发行版,您可能仍然需要进行一些配置,但通常有一个快速安装选项,使您可以轻松部署。

[En]

For other distributions, you may still need to make some configuration, but there is usually a quick installation option that makes it easy for you to deploy.

2、不会影响宿主机

在虚拟机中运行 Linux 的十大优点

不会影响宿主机

对于虚拟机,您可以更自由地使用它们,因为虚拟机系统和主机系统是隔离的。

[En]

For virtual machines, you can use them more freely, because the virtual machine system and the host system are isolated.

很多时候,如果你并不熟悉 Linux 系统,你很可能会把配置弄得十分混乱。

所以在虚拟机中,你可以随意尝试,而不用担心会不会影响主机系统。换句话说,任何虚拟机的运行都不会影响主机,因为它们是完全隔离的。

[En]

So in the virtual machine, you can try at will without worrying about whether it will affect the host system. In other words, the operation of any virtual machine will not affect the host because they are completely isolated.

因此,虚拟机是您最好的试验场,尤其是对于一些激进或破坏性的实验。

[En]

Therefore, the virtual machine is your best proving ground, especially for some radical or destructive experiments.

3、资源可高效共享

在虚拟机中运行 Linux 的十大优点

资源可高效共享

如果您有充足的系统资源,您可以使用一台虚拟机来运行其他任务,以充分利用这些空闲的系统资源。例如,如果您需要一个非常隐私的浏览环境,虚拟机将为您阻止主机的所有跟踪器。

[En]

If you have plenty of system resources, you can use a virtual machine to run other tasks to make full use of these idle system resources. For example, if you need a very private browsing environment, the virtual machine will block all trackers for the host for you.

这可能有点牵强,但这只是一个例子。基于这个想法,你将能够充分利用所有的系统资源。

[En]

This may be a little far-fetched, but this is just one example. Based on this idea, you will be able to make full use of all the system resources.

而对于双启动方案,你需要在单独的磁盘上在 Windows 之后安装 Linux,或者在 Linux 之后安装 Windows,你需要为你的任务锁定相应的资源。

但利用虚拟机,你无需锁定部分资源也可以使用 Linux ,也不必为了特定的任务而临时共享资源,这样会方便许多。

4、多任务体验更好

在虚拟机中运行 Linux 的十大优点

多任务体验更好

有了 资源共享机制,多任务会前所未有的容易。

在双启动的场景下,你需要来回重启切换才能使用 Linux 或 Windows 。

但如果你使用的是一台虚拟机,你几乎不再需要双引导,两个系统将无缝地协同工作,实现多任务处理。

[En]

But if you use a virtual machine, you almost no longer need dual booting, and the two systems will work together seamlessly and multitask.

当然,你需要确认你拥有足够的系统资源和额外的硬件(例如双显示器)来更高效地使用。而多任务的潜力也因 Linux 虚拟机的存在而愈发强大。

5、软件测试更为便捷

有了虚拟化,你将可以创建大量的 Linux 实例,来模拟特定的使用场景,并对软件进行测试。

例如,你可以在不同的 Linux 虚拟机中同步测试不同的软件版本。这有丰富的使用场景,包括对开发版软件进行测试以及 Linux 发行版的早期测试等等。

6、开发更为便捷

在虚拟机中运行 Linux 的十大优点

开发更为便捷

当您正在学习编程或刚刚加入软件项目的开发时,您将希望拥有一个没有冲突和错误的开发环境。

[En]

When you are learning programming or just joining the development of a software project, you will want to have a development environment free of conflicts and errors.

在 Linux 虚拟机里,你可以从零开始搭建一个不会与已经存在的环境冲突的开发环境。例如,你可​ 以在 Ubuntu上 安装并测试 Flutter 。 ​

如果环境出现问题,您可以轻松删除该虚拟机并重新开始更正错误。

[En]

If something goes wrong with the environment, you can easily delete the virtual machine and start over to correct the error.

Linux 虚拟机的隔离环境是一个绝佳的开发和测试环境。

7、学习和研究的好帮手

Linux 值得反复探索。除了基础的计算任务,你可以做许多其他的事情。

您可以学习如何修改您的用户界面,尝试一些常见的桌面环境,并安装许多常见的软件,同时仍然保持对一切的控制。

[En]

You can learn how to modify your user interface, try some common desktop environments, and install a lot of common software, while still keeping everything under control.

如果出现问题,新建一个 Linux 虚拟机就可以解决。当然,这并不仅限于日常使用需要,还可以启发系统管理员在其中测试他们所学的知识。

8、更容易复制和迁移

可以轻松地复制和迁移虚拟机。只要其他主机系统支持该虚拟化程序,您就可以轻松地迁移它,而不需要特殊要求。

[En]

Virtual machines can be easily copied and migrated. As long as other host systems support the virtualization program, you can easily migrate it without special requirements.

无论出于何种原因,只需几次简单的点击即可完成复制和迁移。

[En]

Whatever the reason, copy and migration can be done with a few simple clicks.

9、尝试大量的发行版

在虚拟机中运行 Linux 的十大优点

尝试大量的发行版

你可以在虚拟环境下尝试数以百计的 Linux 发行版。

您可能认为这重复了第7篇文章,但我相信测试发行版是一项巨大的系统工程,特别是当您决定切换到发行版以进行托管或其他目的时。

[En]

You might think this repeats article 7, but I believe that testing a distribution is a huge systematic project, especially if you decide to switch to a distribution for hosting or other purposes.

10、便于调试

无论是严肃的开发活动还是一般的研究,在孤立的虚拟环境中进行调试和调试都相对容易。

[En]

Whether it’s serious development activities or general research, debugging and debugging in an isolated virtual environment is relatively easier.

你可以快速尝试大量的调试方法而无需考虑影响。同时,如果你的宿主机是 Linux 系统的话,无需宿主机上的 root 权限便可以访问和修改虚拟机中的配置文件。

总而言之

如果您不熟悉您正在使用的系统或依赖于不同的操作系统,该虚拟机将是一个强大的工具来帮助您的工作。

[En]

If you are not familiar with the system you are using or rely on different operating systems, the virtual machine will be a powerful tool to assist you in your work.

Linux 虚拟机可以广泛用于开发、学习、试验或任何特定用途。

本文转自:https://juejin.cn/post/7094142283531943950

Original: https://www.cnblogs.com/helong-123/p/16288432.html
Author: 萌褚
Title: 在虚拟机中运行 Linux 的十大优点

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/523569/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球