安装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)


目录
相关文章
|
27天前
|
存储 虚拟化 Windows
VMware安装Windows10
本案例介绍了在Windows系统上使用VMware Workstation 17.5 Pro安装配置Windows 10虚拟机的详细步骤,包括所需设备、软件下载链接、虚拟机设置及系统安装全过程。
VMware安装Windows10
|
13天前
|
人工智能 JavaScript 开发工具
极速上手!Claude Code 原生支持 Windows 免WSL安装教程
Claude Code 现已支持 Windows 原生运行,无需 WSL 配置。本文提供详细安装教程,涵盖 Node.js 环境验证、Git 安装及 Claude Code 配置步骤,助你快速上手这一强大 AI 编程工具。
352 4
|
8天前
|
安全 Ubuntu Linux
Nexpose 8.21.0 for Linux & Windows - 漏洞扫描
Nexpose 8.21.0 for Linux & Windows - 漏洞扫描
66 4
Nexpose 8.21.0 for Linux & Windows - 漏洞扫描
|
13天前
|
安全 Linux 网络安全
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
221 0
|
21天前
|
安全 Java Linux
Nexpose 8.19.0 for Linux & Windows - 漏洞扫描
Nexpose 8.19.0 for Linux & Windows - 漏洞扫描
39 0
Nexpose 8.19.0 for Linux & Windows - 漏洞扫描
|
安全 Linux 测试技术
OpenText Static Application Security Testing (Fortify) 25.3 (macOS, Linux, Windows) - 静态应用安全测试
OpenText Static Application Security Testing (Fortify) 25.3 (macOS, Linux, Windows) - 静态应用安全测试
77 0
|
2月前
|
安全 Linux C++
PVS‑Studio 7.38 for macOS, Linux & Windows - 代码质量安全静态分析
PVS‑Studio 7.38 for macOS, Linux & Windows - 代码质量安全静态分析
108 0
PVS‑Studio 7.38 for macOS, Linux & Windows - 代码质量安全静态分析
|
21天前
|
缓存 安全 Linux
Metasploit Pro 4.22.8-2025082101 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025082101 (Linux, Windows) - 专业渗透测试框架
79 0
|
29天前
|
安全 Linux API
JEB Pro v5.31 (macOS, Linux, Windows) - 逆向工程平台
JEB Pro v5.31 (macOS, Linux, Windows) - 逆向工程平台
69 0
|
Ubuntu Linux 虚拟化
安装Windows Linux 子系统的方法:适用于windows 11 版本
本文提供了在Windows 11系统上安装Linux子系统(WSL)的详细步骤,包括启用子系统和虚拟化功能、从Microsoft Store安装Linux发行版、设置WSL默认版本、安装WSL2补丁,以及完成Ubuntu的首次安装设置。
4217 2