如何在WSL上将Ubuntu版本更改为较早的版本?

huangapple go评论68阅读模式
英文:

How to change ubuntu version to earlier one on wsl?

问题

大家好!我是一个新学习者,需要你们的帮助!最近,我在我的Windows上安装了wsl,它是最新版本的Ubuntu - 22.04。但此刻我需要在Ubuntu 20.04版本上编写bash脚本,不同版本的Ubuntu上脚本运行方式有所不同。

我看到解决这个问题有两种方法。要么更改wsl上的Ubuntu版本,要么连接到虚拟机。

  1. 那么,如果可能的话,我如何返回到wsl上的早期版本?
  2. 或者我如何从我的wsl终端进入到我的Virtual Box中的Ubuntu 20.04?
    或者也许还有另一个解决方案,我不知道。

在此先感谢您的答案!

英文:

everyone! I'm a new learner and I need your help!
Lately, I installed wsl on my Windows for my tasks, it's the latest version of Ubuntu on it - 22.04. But at this moment I need to write bash scripts on Ubuntu 20.04 version, there are differences on how scripts run on different Ubuntu versions.

I see 2 ways of solving this problem. Or to change the version of ubuntu on wsl, or to connect to virtual box machine.

  1. So, how do I return to an earlier version on wsl, if it is possible?
  2. Or how do I enter from my wsl terminal to my ubuntu 20.04 in virtual machine (on Virtual Box)?
    Or maybe there is another solution, that I don't know.

Thank you in advance for your answers!)

答案1

得分: 0

我想写下我是如何解决我的问题的。
在搜索和阅读关于解决我的问题的不同方法后,考虑到这里给出的所有建议,我得出了这样的结论,对我来说,最简单的方法是在我的主机操作系统上(即Windows)创建一个共享文件夹,这个文件夹也可以从我的虚拟机中看到。这样,我可以在那个文件夹中编写和编辑我的任务,然后通过wsl(其中安装了ubuntu 22.04)和虚拟机(其中安装了ubuntu 20.04)同时运行和测试它们。因此,我可以同时了解这些Ubuntu版本之间是否有任何差异。
也许对某人会有帮助!

英文:

I want to write what I did to solve my problem.
After searching and reading about different ways to solve my problem, taking into account all the given advices here, I got to conclusion that the easiest way for me, to create a common folder on my host OS (aka Windows), which will be seen also from my virtual machine. This way I write, edit my tasks in that folder, then run and test both through wsl (which has ubuntu 22.04 on it) and through VM (with ubuntu 20.04 on it). So, at the same time I can learn of there are any differences between these Ubuntu versions.
Maybe this will be helpful to someone!

huangapple
  • 本文由 发表于 2023年6月18日 22:58:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76501149.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定