在Windows10上搭建Linux学习环境
在Windows 10上安装WSL2
参考资料:在 Windows 10 上安装 WSL | Microsoft Docs
在 WSL2 上安装 CentOS
参考资料:在Windows 10上使用WSL安装Centos 知行晓政的博客-CSDN博客
CentOS-WSL 下载地址:GitHub - mishamosher/CentOS-WSL: A Travis CI automated CentOS RootFS to use with WSL
从上面Github地址下载对应的压缩文件,右键点击并解压之。解压后,将在目标目录中看到2个文件:rootfs.tar.gz
和CentOS.exe
。右键点击并以管理员身份运行CentOS.exe
,以便解压其中的文件并注册到WSL。运行后,系统将自动进行初始化。
Using: D:\WinSoftware\CentOS\CentOS8\rootfs.tar.gz
Installing...
Installation Complete!
Press any key to continue...
初始化完成后,同级目录下将出现ext4.vhdx
文件。
修改root
密码:
[root@Chenzf /]# passwd root
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
在 WSL 2 上卸载 CentOS
PS D:\WinSoftware\CentOS\CentOS8> .\CentOS8.exe clean
This will remove this distro (CentOS8) from the filesystem.
Are you sure you would like to proceed? (This cannot be undone)
Type "y" to continue:y
Unregistering...