WSL安装

一、开启WSL

控制面板->程序->程序和功能 中点击 启动或关闭Windows功能如图

WSL_01

勾选 适用于Linux的Windows子系统

WSL_01

二、安装linux

一、直接安装应用商店的Ubuntu

在应用商店搜索linux,选择合适的版本下载即可

(比较简单,不过貌似是只有Ubuntu,而且安装位置不能自己选择)

WSL_02

二、使用LxRunOffline安装

一、下载LXRunOffline

LxRunOffline-v3.4.0.zip

新建文件夹LXRunOffline,下载减压到该文件夹下

LXRunOffline的方便之处:

  • Install any Linux distro to any directory on your computer.
  • Move an existing installation to another directory.
  • Duplicate(copy) an existing installation.
  • Register an existing installation directory. This enables you to install to a USB stick and use it on different computers.
  • Run arbitrary Linux commands in a specified installation.
  • Configure default user, environment variables and various flags.
  • Export configuration to an XML file and import from the file.
  • Export an installation to a tar file.

二、下载Linux镜像文件

CentOS7.zip

这个是CentOS7的镜像文件,也可以自己找其他镜像文件

三、使用LXRunOffline部署Linux到WSL

使用管理员权限打开cmd,cd到刚刚减压LXRunOffline的文件夹,执行下面的命令

1
2
LxRunOffline.exe  install -n centos -d E:\ProgramData\Microsoft\Windows\WSL\CentOS -f  E:\Progra
mData\Microsoft\Windows\WSL\centos-7-docker.tar.xz

其中 -d 后面是要安装到的目录,-f 是前面下载的镜像, -n 用来指定名称。

四、启动linux

然后使用 LxRunOffine 来开启 Centos

执行 LxRunOffline run -n centos

如果想在任何位置使用LXRunOffline,只需要把该文件夹加入环境变量就行。

参考链接

-------------本文结束感谢您的阅读-------------