WSL 安装和使用

2019-02-19  本文已影响0人  u14e

1. 启用 WSL 功能

管理员身份打开 PowerShell,输入如下命令(然后根据提示重启电脑):

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

2. 下载和安装 Linux 系统

下载地址: Ubuntu 18.04 (推荐迅雷)

双击 .appx 文件进行安装,按照提示设置用户名和密码,然后就安装成功了

image.png

备份官方源,重写为国内 ubuntu 源:

# 备份
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 重写
sudo vi /etc/apt/sources.list

/etc/apt/sources.list的内容:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

更新系统包和软件: sudo apt update && sudo apt upgrade

其他系统下载参考 https://docs.microsoft.com/en-us/windows/wsl/install-manual

3. 设置

3. 参考链接

上一篇下一篇

猜你喜欢

热点阅读