拓冰建站拓冰建站
首页 / 资讯中心 / 正文

Win11使用wsl安装Ubuntu26.04

概述Windows 11 安装WSL然后部署Ubuntu2604管理员启动PowerShellPS C:\Windows\system32wsl--installUbuntu-26.04 正在下载: 适用于 Linux 的 Windows 子系统2.7.12 正在安装: 适用于 Linux 的 Windows 子系统2.7.12 已安装 适用于 Linux 的 Windows 子系统2.7.12。 正在安装 Windows 可选组件: VirtualMachinePlatform 部署映像服务和管理工具 版本:10.0.26100.8972 映像版本:10.0.26200.9168 启用一个或多个功能[100.0%]操作成功完成。 请求的操作成功。直到重新启动系统前更改将不会生效。 请求的操作成功。直到重新启动系统前更改将不会生效。 PS C:\Windows\system32重启后查看可安装系统PS C:\Windows\system32wsl--list--online以下是可安装的有效分发的列表。 使用“wsl.exe--installDistro”安装。 NAME FRIENDLY NAME Ubuntu Ubuntu Ubuntu-26.04 Ubuntu26.04LTS Ubuntu-24.04 Ubuntu24.04LTS Ubuntu-22.04 Ubuntu22.04LTS openSUSE-Tumbleweed openSUSE Tumbleweed openSUSE-Leap-16.0 openSUSE Leap16.0SUSE-Linux-Enterprise-15-SP7 SUSE Linux Enterprise15SP7 SUSE-Linux-Enterprise-16.0 SUSE Linux Enterprise16.0kali-linux Kali Linux Rolling Debian Debian GNU/Linux AlmaLinux-8 AlmaLinux OS8AlmaLinux-9 AlmaLinux OS9AlmaLinux-Kitten-10 AlmaLinux OS Kitten10AlmaLinux-10 AlmaLinux OS10archlinux Arch Linux FedoraLinux-44 Fedora Linux44FedoraLinux-43 Fedora Linux43eLxr eLxr12.12.0.0 GNU/Linux OracleLinux_7_9 Oracle Linux7.9OracleLinux_8_10 Oracle Linux8.10OracleLinux_9_5 Oracle Linux9.5SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise15SP6 PS C:\Windows\system32安装Ubuntu26.04安装方式一PS C:\Windows\system32wsl--installUbuntu-26.04 正在下载: Ubuntu26.04LTS 正在安装: Ubuntu26.04LTS 已成功安装分发。可以通过 “wsl.exe-dUbuntu-26.04” 启动它 正在启动 Ubuntu-26.04... Provisioning the new WSL instance Ubuntu-26.04 This might take a while... Create a default Unix user account: youraccount New password: Retype new password: passwd: password updated successfully usermod: no changes Help improve Ubuntu!Help us improve Ubuntu features and compatibility by sharing system reports with Canonical. Reports are sent anonymously anddonot contain any personal data. For legal details, please visit: https://ubuntu.com/legal/systems-information-notice We will save your answer to Windows and will only ask you once. Would you like to opt-in to platform metrics collection(Y/n)? To see an example of the data collected, entere.[Y/n/e]: n安装方式二如果上述自动安装不行可以浏览器直接下载https://releases.ubuntu.com/26.04/ubuntu-26.04-wsl-amd64.wsl双击ubuntu-26.04-wsl-amd64.wsl进行安装查验系统版本版本代号 VERSION_CODENAMEresoluterootSJ-PC:~# cat /etc/os-releasePRETTY_NAMEUbuntu 26.04.1 LTSNAMEUbuntuVERSION_ID26.04VERSION26.04.1 LTS (Resolute Raccoon)VERSION_CODENAMEresoluteIDubuntuID_LIKEdebianHOME_URLhttps://www.ubuntu.com/SUPPORT_URLhttps://help.ubuntu.com/BUG_REPORT_URLhttps://bugs.launchpad.net/ubuntu/PRIVACY_POLICY_URLhttps://www.ubuntu.com/legal/terms-and-policies/privacy-policyUBUNTU_CODENAMEresoluteLOGOubuntu-logo rootSJ-PC:~#添加阿里云源编辑ubuntu.sourcesnano/etc/apt/sources.list.d/ubuntu.sources在文件最后添加阿里云的源注意版本代号......#### See the sources.list(5) manual page for further settings.Types: deb URIs: http://archive.ubuntu.com/ubuntu/ Suites: resolute resolute-updates resolute-backports Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg## Ubuntu security updates. Aside from URIs and Suites,## this should mirror your choices in the previous section.Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: resolute-security Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg# 阿里云镜像源额外添加Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute resolute-updates resolute-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg更新验证输出中出现 mirrors.aliyun.com 的命中信息且无报错即可sudoaptupdate修改镜像网络Windows 11 22H2 及以上版本并且安装了最新的 WSL 更新包可以开启 WSL 2 的“镜像模式”网络。开启后WSL 2 的 IP 会直接与 Windows 主机一致IP 不再变化且可直接通过 localhost 互通cmd命令下执行创建 .wslconfig 文件notepad%USERPROFILE%\.wslconfig.wslconfig 添加以下内存[wsl2]networkingModemirroredfirewallfalsePowerShell下重启WSLPS C:\Windows\system32wsl--shutdownPS C:\Windows\system32
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门