安装WSL(Windows Linux)

简介: 安装WSL(Windows Linux)

---

title: 安装WSL(Windows Linux)

date: 2020-04-18 09:09:09.0

updated: 2020-05-24 14:44:28.0

url: https://www.ufec.cn/archives/5.html

thumbnail: https://ghproxy.com/https://raw.githubusercontent.com/ufec/picGoImg/main/blog/2020/05/wsl-285f5aa5262f4102ba3a09b43a576705.webp

categories:

 - 日常

tags:

 - WSL

---


## 开始安装


在自带的 MicrosoftStore 搜索 Linux,选择自己想要的系统,

![store.webp](https://ghproxy.com/https://raw.githubusercontent.com/ufec/picGoImg/main/blog/2020/04/store-4ab3534639f6460097c319ceea157bcc.webp)

这里我选的 Ubuntu,直接搜 Ubuntu 也可,安装完成后启动,如果有如下提示

![install.webp](https://ghproxy.com/https://raw.githubusercontent.com/ufec/picGoImg/main/blog/2020/04/install-3bb67cc367fe443c945f3e350aaa3a45.webp)

当然也可能报错,无法启动。那就可能是没开启 WindowsLinux 子系统支持,打开程序和功能->启用或关闭 Windows 功能,找到适用于 Linux 的 Windows 子系统,勾选确定等待配置,重启,即可打开


切换 root 用户

![root.webp](https://ghproxy.com/https://raw.githubusercontent.com/ufec/picGoImg/main/blog/2020/04/root-41a9765651cc42cfbfc22a718e9ccda2.webp)


## 一些要点


WSL 是 Windows 的一个子服务,终端中无法重启 Windows 的服务,如果使用 reboot 命令,会报一个


```shell

System has not been booted with systemd as init system (PID 1). Can't operate.

```


的错误,如果有重启的需要可以以管理员身份运行 PowerShell,输入


```shell

Get-Service LxssManager | Restart-Service

```


LxssManager 就是 Linux 服务,重启它即可


## 换源操作


```shell

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

sudo chmod 777 /etc/apt/source.list

vi /etc/apt/source.list

```


删除原来的,换为阿里源


```shell

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

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

```


```shell

sudo apt update

sudo apt upgrade

```


## 安装图形化界面


```shell

apt-get install vnc4server

vnc4server

```


除此启动需要设置密码

编辑配置文件


```shell

vi /root/.vnc/xstartup

```


修改如下


```shell

#!/bin/sh

export XKL_XMODMAP_DISABLE=1

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

gnome-panel &

gnome-settings-daemon &

metacity &

nautilus &

gnome-terminal &

#这是gnome的配置

```


安装图形化界面 gnome(这个很简洁),追求美观可以去找别的,界面如下

![gui.webp](https://ghproxy.com/https://raw.githubusercontent.com/ufec/picGoImg/main/blog/2020/04/gui-d695dd390efd41ce988e1422b6575279.webp)


目录
相关文章
|
3天前
|
NoSQL Linux 网络安全
Linux安装Redis(详细教程)
Linux安装Redis(详细教程)
22 2
|
3天前
|
并行计算 C++ 异构计算
【环境配置】安装windows版本的TensorRt
【环境配置】安装windows版本的TensorRt
14 4
|
3天前
|
IDE Linux 开发工具
Linux 系统上安装
在Linux和Mac上安装Lua 5.3.0只需下载源码,解压,编译和安装。Windows用户可选择SciTE IDE或通过LuaForWindows在Github或Google Code下载安装。创建 HelloWorld.lua,使用`lua HelloWorld.lua`运行显示"Hello World!"。另可参考LuaDist官方推荐方式安装。
|
3天前
|
弹性计算 分布式计算 Hadoop
Linux(阿里云)安装Hadoop(详细教程+避坑)
Linux(阿里云)安装Hadoop(详细教程+避坑)
25 3
|
3天前
|
监控 JavaScript 网络协议
Linux系统之安装uptime-kuma服务器监控面板
【5月更文挑战第12天】Linux系统之安装uptime-kuma服务器监控面板
14 0
|
3天前
|
Ubuntu Linux Shell
minio服务端以Linux服务形式安装
minio服务端以Linux服务形式安装
19 6
|
3天前
|
TensorFlow 算法框架/工具 C++
在有GPU的windows上安装TensorFlow
在有GPU的windows上安装TensorFlow
20 0
|
3天前
|
Windows
Windows 系统下安装
安装Windows版Julia:访问[julialang.org/downloads](https://julialang.org/downloads/)下载安装程序。64位Julia适用于64位Windows,32位兼容32/64位系统。运行安装向导,一路点击Next,选中"Add Julia To PATH"选项以添加到系统路径。完成后,即可在终端使用Julia命令。默认安装路径:C:\Users\BAIDU\AppData\Local\Programs\Julia 1.7.2。
|
3天前
|
关系型数据库 MySQL Linux
Linux下安装MySQL
Linux下安装MySQL
16 0
|
3天前
|
安全 Linux 网络安全
【操作系统】实验一 Linux操作系统安装
【操作系统】实验一 Linux操作系统安装
9 3