Windows安装WSL(解决VMware Workstation和Hyper-V不兼容)

VMware 和Hyper-V不兼容,然而Linux不能使用VMware虚拟机启动,但是如果卸载Hyper-V,之后Docker就不能使用了。在window下Docker和用VMware创建的虚拟机会产生冲突。两种虚拟化技术都是基于CPU等底层硬件的Hypervisor(虚拟机监视器)机制来实现的。所以考虑使用linux 虚拟机使用Window自带的WSL.

WSL安装

前提打开Windows功能
在程序中勾选适用于Linux的Windows子系统
在这里插入图片描述
重启电脑,之后WSL功能生效。

安装WSL

可以借助win10自带的商城里面安装。但是由于我用的win10企业版的把商店卸载了。就用命令安装了。
一下命令在PowerShell中执行。

#创建目录
New-Item J:\WSL -ItemType Directory
Set-Location J:\WSL

#从网站上下载ubuntu文件并解压缩
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
Rename-Item .\Ubuntu.appx Ubuntu1604.zip
Expand-Archive .\Ubuntu1604.zip -Verbose

#运行程序
cd Ubuntu1604
.\ubuntu1604.exe

在这里插入图片描述
现在就安装成功。
在这里插入图片描述
查看安装的发行版本

换源

cd /etc/apt 
cp /sources.list sources.list.bak 
vim sources.list 

更换阿里源

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新系统

sudo apt-get update
sudo apt-get upgrade

在这里插入图片描述
现在window下的linux能正常运行,Docker也能正常使用。

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值