惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
P
Privacy International News Feed
L
LINUX DO - 热门话题
T
Threatpost
Latest news
Latest news
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Cyberwarzone
Cyberwarzone
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
NISL@THU
NISL@THU
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
V
Vulnerabilities – Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
H
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
Security Latest
Security Latest
博客园 - 叶小钗
博客园 - Franky
The Hacker News
The Hacker News
Engineering at Meta
Engineering at Meta
Scott Helme
Scott Helme
S
Securelist
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
A
About on SuperTechFans
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
B
Blog RSS Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
月光博客
月光博客
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tor Project blog
A
Arctic Wolf

CAYZLH

MacBook上备忘录APP的快捷键和手势 让Google屏蔽某些搜索结果 typora自动上传图片配置 自建giscus服务 Windows下结束指定端口的进程 批量修改maven多模块版本号 使用winsw部署SpringBoot项目 Gson简易指南 docker搭建Consul集群 使用Docker部署SpringBoot项目 Docker使用redis镜像 Docker使用rabbitmq Docker使用zookeeper Docker使用MySQL Dockerfile常用指令 Docker免sudo操作 雷鸟电视去广告 使用ADB卸载MIUI系统应用 利用GitHub做图床 将网站变成灰色 Github上传大文件 Android远程调试命令adb vscode快捷键的使用 SpringBoot文件上传异常处理 SpringBoot封装JedisUtils工具类 SpringBoot自动部署脚本 使用Spring读取文件的几种方式 Spring统一异常返回 利用Github做Maven私服 Redis常用指令 Maven常用指令 使用mysqldump导出数据 SpringBoot动态切换多数据源 Java8的日期处理实践 lambda表达式语法 Stream表达式语法 使用Optional优雅地判空 Android Support vs AndroidX 「Vue」Runtime-Complier和Runtime-only的区别 RecyclerView使用记录 动态设置布局之LayoutInflater Redis分布式锁的几种方案 打造一个舒服的写作环境(Hexo) 深入了解与使用ThreadLocal Maven中dependencyManagement的作用 Redis配置认证密码 nginx简单配置示例 Linux(macOS)换源 Linux搭建Git服务器 Linux配置ssh使用公钥登录远程服务器 Linux下find与exec的使用 Linux排查Java问题工具单 Linux常用命令 MySql数据库优化细节 API签名验证方案 Java集合框架 Redis基础知识总结 Spring事务管理 Redis为什么这么快 SpringBoot实现Jwt单点登录 SpringBoot实现Redis分布式锁 Spring面向切面编程(知识梳理) SpringBoot异步请求和异步调用 Mybatis中用到的几种设计模式 Docker Swarm RocketMQ相关流程图/原理图 SonarQube的安装与使用 宝塔面板部署vue项目 Tomcat的三种接收请求处理方式 Docker知识扫盲 安装Jenkins并用于部署SpringBoot项目 Tomcat单机多实例部署 Maven中Scope的分类 Springboot集成Shiro(前后端分离) Linux搭建frp服务(内网穿透) Redis高逼格指令 Docker私有仓库的搭建与使用 Dockerfile使用介绍 Redis的使用场景 Docker的网络模式
WSL自定义安装Ubuntu
Ant丶 · 2024-06-16 · via CAYZLH

WSL

WSL提供了一个微软开发的Linux兼容内核接口(不包含Linux代码),来自Ubuntu的用户模式二进制文件在其上运行。

该子系统不能运行所有Linux软件,例如那些图形用户界面,以及那些需要未实现的Linux内核服务的软件。不过,这可以用在外部X服务器上运行的图形X Window系统缓解。

此子系统起源于命运多舛的Astoria项目,其目的是允许Android应用运行在[Windows 10](https://baike.baidu.com/item/Windows 10/6877791?fromModule=lemma_inlink) Mobile上。此功能组件从Windows 10 Insider Preview build 14316开始可用。

2022年9月 22日,微软发布了 [Windows 11](https://baike.baidu.com/item/Windows 11/57321047?fromModule=lemma_inlink)/10 的 Linux 子系统新预览版,微软宣布从该版本开始,WSL 已支持 systemd

具体安装过程

启用Linux子系统的功能

首先,需要在Windows Server或Win11(Win10)上,启用WSL功能:

  • 打开PowerShell作为管理员。

  • 执行以下命令启用适用于Linux的Windows子系统特性:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • 重启电脑

下载WSL格式的Ubuntu系统镜像

方式一

Microsoft Store下载并安装Ubuntu 16.04 LTS或更高版本。至此,在微软商店里安装Ubuntu操作系统就全部完成了。

但是由于本人电脑上经常连不上Microsoft Store服务,处于不可用状态,使用方式二进行安装

方式二

从Ubuntu官网下载WSL系统:

Ubuntu官网WSL的下载地址:https://cloud-images.ubuntu.com/wsl/

进入后,找到结果为wsl.rootfs.tar.gz的文件,根据自己的需要选择一个版本并下载下来。

image-20240619150900437

安装Ubuntu WSL镜像

  • 将下载的wsl.rootfs.tar.gz文件,移动到一个文件夹,例如 C:\Ubuntu\ , 下载的文件是以 -wsl.rootfs.tar.gz结尾的

  • 重命名为ubuntu16.04-wsl.tar.gz (版本号可以根据实际情况调整)

  • Powershell命令,在Windows系统里安装Ubuntu操作系统(导入到Linux子系统)

    Powershell命令格式:

    wsl --import <DistroName> <location to Install> <location of wsl.rootfs.tar.gz File>

    比如,安装到C盘的 C:\Ubuntu\ubuntu16.04目录:

    wsl --import Ubuntu16.04 C:\Ubuntu\16.04  C:\Ubuntu\ubuntu16.04-wsl.tar.gz

    安装大概需要半分钟到1分钟,当PowerShell换了新的一行,说明import安装完成了。

  • 安装完成后, 使用wsl -l命令检查最新的子系统:

    wsl -l

    image-20240619151611544

安装完成

需要手动启动Ubuntu子系统,由于没有从Microsoft Store安装此应用程序,因此在“开始”菜单中没有创建应用程序快捷方式。所以,你需要手动启动它;

// 手动启动命令 
wsl -d Ubuntu16.04

如果有安装 **Windows terminal**终端的话, 子系统也会被直接加载到配置里面,打开后可以直接食用:

image-20240619152001403

碰到的问题

刚安装完成的时候,出现了以下问题:

wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。

解决方法

Windows中的C:\Users\<your_username>目录下创建一个.wslconfig文件,然后在文件中写入如下内容:

[experimental]
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

配置后执行wsl --shutdown关闭WSL,之后再重启子系统,问题解决;