文章目录
WSL支持Linux版本查看
- 如果想了解
wsl
支持哪些Linux操作系统,可以输入命令:wsl --list -o
来查看,当前支持版本如下 :
WSL安装Ubuntu
- 以管理员方式启动
Powershell
或者Terminal
,运行命令wls --install
即可安装默认版本Ubuntu; - 等待安装完成后,按提示输入用户名和密码后,即可使用了;
- 登录方法,在
powershell
或terminal
中输入wsl
或ubuntu
即可启动。
PS C:\Users\Lenovo> wsl --install -d ubuntu-18.04
Installing: Ubuntu 18.04 LTS
Ubuntu 18.04 LTS has been installed.
Launching Ubuntu 18.04 LTS...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: evan
Enter new UNIX password:
Retype new UNIX password:
The operation completed successfully.
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
从默认Ubuntu升级到最新版本!
当前WSL默认ubuntu版本是22.04版本,如果想要升级到最新的24.04版本LTS,可以按如下方法进行:
- 确认Ubuntu安装配置方式:
vi /etc/update-manager/release-upgrades
确保Prompt
为LTS
:
2. 确保系统当前是最新的:
sudo apt-get update
sudo apt-get upgrade
- 开始升级!
sudo do-release-upgrade -d
如果执行上面命令时报如下错误时,可以尝试强行升级:
$ sudo do-release-upgrade
Checking for a new Ubuntu relea