Windows下安装和配置WSL

百度百科描述WSL:Windows Subsystem for Linux(简称WSL)是一个在Windows 10上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。它是由微软与Canonical公司合作开发,其目标是使纯正的Ubuntu 14.04 "Trusty Tahr"映像能下载和解压到用户的本地计算机,并且映像内的工具和实用工具能在此子系统上原生运行。

1、启用或关闭Windows功能

2、安装WSL
在微软应用商店(https://www.microsoft.com/zh-cn/store/)搜索 Linux,选用 Ubuntu ,下载完成后安装,然后重启电脑,打开Ubuntu应用,发现出现下面错误。

The WSL optional component is not enabled. Please enable it and try again

错误解决办法:
1)在Windows“开始”处右键打开,选择Windows PowerShell管理员打开;

输入下面命令后回车执行:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2)在设置–>更新和安全–>开发者选项处,将开发人员模式打开;
在这里插入图片描述

完成后,重启电脑;

打开Ubuntu应用,
创建用户名跟密码:

3、配置 WSL
1)更改源
备份原来的源:sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑文件:sudo vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

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

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

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

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

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

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

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

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

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

2)更新和升级

sudo apt-get update
sudo apt-get upgrade

3)安装zsh

sudo apt-get install zsh

设置默认 shell 为 zsh

chsn –s $(which zsh)

设置完成后使用下列命令检查是否设置成功

echo $SHELL

4)设置 ys 主题

sudo vim ~/.zshrc
ZSH_THEME="ys"  
source ~/.zshrc
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值