|
本帖最后由 Daniel_Arndt 于 2022-5-1 11:53 编辑
其实WSL1也是可以的,我当时装的是CentOS 8,后来把CentOS 8迁移到了AlmaLinux(当时我想装的是AlmaLinux的WSL1,但实践过程中发现用AlmaLinux官方提供的docker来安装WSL1的话,会出的问题比从CentOS的WSL1迁移到AlmaLinux的WSL1会出的问题还多,现在其实没必要像我当初一样折腾了,AlmaLinux官方于2022年4月1日提供了“AlmaLinux 8 WSL”,可以从Microsoft Store安装 https://apps.microsoft.com/store ... ?hl=en-us&gl=US )。
创建D:\wsl1文件夹,从 https://github.com/CentOS/sig-cl ... layer.x86_64.tar.xz 下载CentOS-8-Container-8.1.1911-20200113.3-layer.x86_64.tar.xz,放到D:\wsl1文件夹下。从 https://github.com/DDoSolitary/LxRunOffline/releases 下载LxRunOffline-v3.5.0-msvc.zip,把压缩包里面的LxRunOffline.exe和LxRunOfflineShellExt.dll放到C:\Windows\System32文件夹。然后创建D:\wsl1\centos文件夹,在Windows命令提示符中运行“LxRunOffline install -n CentOS -d D:\wsl1\centos -f D:\wsl1\CentOS-8-Container-8.1.1911-20200113.3-layer.x86_64.tar.xz -s”,然后桌面上就会出现一个CentOS的快捷方式。
接着打开CentOS,运行“yum update”、“yum install passwd”(此docker中一开始是没有安装passwd的,必须手动安装),然后才可以给root设置密码、创建带密码的普通用户。
WSL里面运行“yum”命令时,可能会报错:
RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
RPM: error: cannot open Packages index using db5 - (-30969)
RPM: error: cannot open Packages database in /var/lib/rpm
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: Could not run transaction.
解决方案是先运行“rm /var/lib/rpm/.rpm.lock”,再运行“yum clean packages”。
如果想修改WSL的默认用户的话,照着这个网页 https://superuser.com/questions/ ... nstalled-wsl-distro 操作即可。如果想把WSL1里面的CentOS 8迁移到AlmaLinux的话,照着这个网页 https://cloudlinuxtech.com/migrate-from-centos-8-to-almalinux-8/ 操作即可。需要注意的是WSL1没有GRUB( https://github.com/microsoft/WSL/issues/1965 ),因而运行“bash almalinux-deploy.sh”后的输出应该是下面这样的,无需为最后的“ERROR”操心:
Complete!
Run dnf distro-sync -y OK
Restoring of alternatives is done OK
Install AlmaLinux kernel ERROR
/usr/sbin/grub2-probe: error: failed to get canonical path of `rootfs'. |
|