WSL 安装 Ubuntu

WSL 安装 Ubuntu

系统使用windows 11

启用 Windows 虚拟化和 Linux 子系统功能

  • 打开 “启用或关闭 Windows功能”,找到并勾选以下选项 (完成后需重启):
    • Virtual Machine Platform
    • Hyper-V
    • 适用于 Linux 的 Windows 子系统

更新 WSL

打开终端,输入更新命令:

wsl --install -d Ubuntu 
如果是第一次使用 wsl,可能会下载 wsl 安装包,使用命令行的方式下载速度可能很慢,可以点击这里 手动下载 WSL 离线包并安装。

安装 Ubuntu 22.04

在终端中输入命令:

wsl --install -d Ubuntu-22.04 

等待下载并安装,安装完毕后要求输入 Ubuntu 的用户名和密码。

更换软件源

  • sudo nano /etc/apt/sources.list
  • 替换为阿里源
  • 操作方法:
    • 按下 Alt + \ 将光标移动到文件开头
    • 按下 Alt + A 设置锚点
    • 按下 Alt + / 将光标移动到文件结尾
    • Ctrl + K(剪切) 或 Alt + D(直接删除)
    • 复制阿里安装源
    • 鼠标右键单击粘贴在 nano 中

22.04 阿里源:

deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse 

更新系统

sudoapt update sudoapt upgrade 

文件互传

文件管理器左侧边栏下部:Linux

在这里插入图片描述


如果你已经进入 WSL,可以用:

cp /mnt/c/path/to/file ~/destination/ mv /mnt/c/path/to/file ~/destination/ 

wsl 常用命令

  • wsl --update 这个命令只是更新 WSL 内核和相关组件(比如 WSLg、系统支持文件),并不会自动安装或更新 Ubuntu 发行版。
  • wsl --list --online 查看 WSL 当前支持、可以直接安装的 Linux 发行版列表
  • wsl --list --verbose 查看已安装
  • wsl --set-default-version 2 :默认安装到 wsl2
  • wsl -d Ubuntu-22.04 启动指定的 Ubuntu
  • wsl --unregister Ubuntu-20.04:卸载
  • wsl --shutdown:重启wsl

wsl --install -d Ubuntu 默认安装最新的

# 安装 Ubuntu 22.04 wsl --install -d Ubuntu-22.04 # 安装 Ubuntu 20.04 wsl --install -d Ubuntu-20.04 # 安装 Ubuntu 18.04 wsl --install -d Ubuntu-18.04 # 安装 Ubuntu 16.04 微软已经下架了这个旧版本 wsl --install -d Ubuntu-16.04 ``` 

vscode 远程连接

vscode 中搜索 WSL 扩展,安装完毕后按下图查看 Ubuntu 系统:

在这里插入图片描述


点击 Ubuntu -22.04 右侧的箭头,连接到 Ubuntu :

在这里插入图片描述

wsl 踩坑

无法访问外网:wsl setting - 网络 - 网络模式 - Mirrored(镜像模式)

在镜像模式下,wsl 会复制主机的网络接口,如果是单网卡多 IP ,则 Ubuntu 默认使用那个配置了路由的网段 IP。

在这里插入图片描述

设置开发环境

本地编译

本地编译需要安装开发工具和必要的库。需要安装以下包:

 $ sudoapt update $ sudoaptinstallgawkwgetgit diffstat unzip texinfo \ gcc-multilib build-essential chrpath socat libsdl1.2-dev \ xterm ncurses-dev lzop libelf-dev 

交叉编译

32 位 ARM 交叉编译器和工具链
sudoaptinstall gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf 
如果安装软件浮点数版本,将 gnueabihf 改为 gnueabi
64 位 ARM 交叉编译器和工具链
sudoaptinstall gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu 
指定编译器版本

上面的命令是安装 Ubuntu 发行版支持的最新版本,如果要指定特定的编译器版本,使用:gcc-<version>-<arch>-linux-gnu* ,其中 version 是一个数字,代表 gcc 的版本。比如安装 GCC8,可以使用:

sudoaptinstall gcc-8-aarch64-linux-gnu 

下载 Linux 源码

下载最新源码

使用下列命令下载最新的 Linux 源码,这里使用 depth=1 来避免下载历史记录(几个 GB大小),只是选择上一次提交的历史记录(2025.11 月大约 270 MB):

git clone https://github.com/torvalds/linux --depth=1

或者:

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git --depth=1
github 站点和 kernel.org 站点是官方下载站点,但在国内的速度都相当慢,还存在下载一半失败的现象。这里推荐国内的镜像站点(码云,每日同步):

下载指定版本

上述是克隆最新的 Linux 代码,大部分时候我们需要指定的版本,比如克隆 v5.10 版本。有两种方法:

克隆指定的版本(只含该版本对应的一个 commit)

git clone --depth=1 --branch=v5.10 https://github.com/torvalds/linux 

完整克隆,然后 checkout :

git clone https://github.com/torvalds/linux git checkout v5.10 

其它 Ubuntu 版本的安装源(阿里源)

Ubuntu 24.04

deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse 

Ubuntu 20.04

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 

Ubuntu 18.04

deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 

Read more

一天开13个会、一个Bug要修200天!前亚马逊L7爆料:这轮大裁员,AI只是“背锅侠”

一天开13个会、一个Bug要修200天!前亚马逊L7爆料:这轮大裁员,AI只是“背锅侠”

整理 | 郑丽媛 出品 | ZEEKLOG(ID:ZEEKLOGnews) 过去一年,大型科技公司的裁员消息几乎从未停过。但当公司对外给出的理由越来越统一,“AI 让组织更高效”,也有越来越多内部员工开始提出另一种质疑:事情或许没那么简单。 最近,一段来自前亚马逊员工 Becky 的 YouTube 视频在开发者社区流传开来。她曾在亚马逊工作 7 年,其中 5 年担任 L7 级别的技术管理者,负责过团队年度规划(OP1)等核心管理工作——可去年,她主动离开了亚马逊。 就在最近,她的三位前同事接连被裁,其中两人还是 H-1B 签证员工,都背着房贷压力。其中一位同事忍不住给 Becky 发消息:“你去年离开的时候,是不是已经预料到会发生这些?” 对此,Becky 的回答很坦诚:她不知道具体什么时候会裁员,但她早就感觉情况不对劲了。 在她看来,这轮裁员被归因为

By Ne0inhk
用 10% GPU 跑通万亿参数 RL!马骁腾拆解万亿参数大模型的后训练实战

用 10% GPU 跑通万亿参数 RL!马骁腾拆解万亿参数大模型的后训练实战

整理 | 梦依丹 出品 | ZEEKLOG(ID:ZEEKLOGnews) 左手是提示词的工程化约束,右手是 Context Learning 的自我进化。 在 OpenAI 新发布的《Prompt guidance for GPT-5.4》中,反复提到了 Prompt Contracts(提示词合约)。要求开发者像编写代码一样,严谨地定义 Agent 的输入边界、输出格式与工具调用逻辑,进而换取 AI 行为的确定性。 但在现实操作中,谁又能日复一日地去维护那些冗长、脆弱的“提示词代码”? 真正的 Agent,不应只靠阅读 Context Engineering,更应该具备 Context Learning 的能力。 为此,在 4 月 17-18

By Ne0inhk
当OpenClaw引爆全网,谁来解决企业AI Agent的“落地焦虑”?

当OpenClaw引爆全网,谁来解决企业AI Agent的“落地焦虑”?

2026 年 3 月,开源 AI Agent 框架 OpenClaw 在 GitHub 上的星标突破28万,并一度超越 React,成为 GitHub 最受关注的软件项目之一。短时间内,开发者利用它构建了大量实验性应用:从全栈开发辅助,到自动化营销脚本,再到桌面操作自动化,AI Agent 的能力边界正在迅速被拓展。 这股热潮也带动了另一个趋势——本地部署与算力硬件需求的快速增长。越来越多开发者尝试在个人设备或企业服务器上运行 Agent 系统,以获得更高的控制权和数据安全性。 从表面上看,AI Agent 似乎正从“概念验证”走向更广泛的开发实践。但在企业环境中,情况却没有想象中乐观。当企业负责人开始追问—— “它能直接解决我的业务问题吗?” 很多演示级产品仍难以给出令人满意的答案。 如何让 Agent 真正融入企业既有系统、适配复杂业务流程,正成为大模型产业落地必须跨越的一道门槛。 与此同时,中国不同城市的产业结构差异明显:互联网、

By Ne0inhk
二手平台出现OpenClaw卸载服务,299元可上门“帮卸”;2026年春招AI人才身价暴涨:平均月薪超6万;Meta辟谣亚历山大·王离职 | 极客头条

二手平台出现OpenClaw卸载服务,299元可上门“帮卸”;2026年春招AI人才身价暴涨:平均月薪超6万;Meta辟谣亚历山大·王离职 | 极客头条

「极客头条」—— 技术人员的新闻圈! ZEEKLOG 的读者朋友们好,「极客头条」来啦,快来看今天都有哪些值得我们技术人关注的重要新闻吧。(投稿或寻求报道:[email protected]) 整理 | 苏宓 出品 | ZEEKLOG(ID:ZEEKLOGnews) 一分钟速览新闻点! * 微信员工辟谣“小龙虾可自动发红包”:不要以讹传讹 * 蚂蚁集团启动春招,超 70% 为 AI 相关岗位 * 受贿 208 万!拼多多一员工被抓 * 2026 年春招 AI 人才身价暴涨: 平均月薪超 6 万元 * 二手平台出现 OpenClaw 上门卸载服务 * 权限太高,国家互联网应急中心发布 OpenClaw 安全应用的风险提示 * 字节豆包内测 AI 电商功能:无需跳转抖音,日活用户数超

By Ne0inhk