最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Windows11 安装 WSL2,wsl2+ubuntu子系统+docker 感受丝般顺滑

运维笔记admin19浏览0评论

主板BIOS中开启虚拟化

启动电脑,按DEL键,进入BIOS页面
进入Advanced,CPU Configuration ,修改Intel(VMX) Virtualization Technology为Enabled,保存重启

安装WSL2

Microsoft WSL官方安装文档网址:https://docs.microsoft/en-us/windows/wsl/install-manual
步骤一:安装 WSL1

以管理员身份打开 PowerShell并输入以下命令:

 dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

步骤二:启用虚拟机功能

以管理员身份打开 PowerShell并输入以下命令:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

重启一下电脑,进入步骤三

步骤三:下载 Linux 内核更新包

适用于 x64 机器的 WSL2 Linux 内核更新包
下载并安装更新包

步骤四:将 WSL 2 设置为默认版本

以管理员身份打开 PowerShell并输入以下命令:

wsl --set-default-version 2


在启动或关闭windows功能中勾选下面2项配置

步骤五:安装ubuntu

打开Microsoft Store并搜索ubuntu


下载自动完成安装,输入用户名,密码。
恭喜!您已经成功安装并设置了一个与您的 Windows 操作系统完全集成的 Linux 发行版!
查看当前系统wsl版本:wsl -l -v

安装 Docker 桌面

下载Docker Desktop
如果您在支持 WSL 2 的系统上安装了 Docker Desktop,则默认情况下将启用WSL 2 的引擎复选框。

快速绑定集成ubuntu子系统

wsl2+ubuntu子系统+docker 感受丝般顺滑

在ubuntu中查看docker版本

简单运行一个nginx容器试一试,
docker pull nginx
docker image ls
docker run -d --name nginx -p 80:80 nginx
curl 127.0.0.1 # ubuntu中测试访问

在win11中直接通过http://localhost/ 即可以访问到ubuntu里的docker nginx

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>