注意: Guest OS 的版本要在 Windows Server build 18945 版本以上,這裡的範例是使用 Windows Server 2004的版本
在VM安裝完成後,第一步就是先啟用VM的巢狀虛擬化
以Hyper-V為例(使用powershell)
Get-VM "VM的名字" | Set-VMProcessor -ExposeVirtualizationExtensions $true
各種VM啟用的方式,參考資料如下
Hyper-V 參考這裡
VirtualBox 參考這裡
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
安裝完之後重新開機
Restart-Computer
Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile c:\wsl_update_x64.msi -UseBasicParsing
下載完成後執行
c:\wsl_update_x64.msi
會有畫面出來讓你按下一步(我還以為Server Core都沒有UI咧)。
Learn More →
安裝完成之後重新開機
Restart-Computer
wsl --set-default-version 2
成功啟用會有下列訊息,正常只會出現一行 有關 WSL 2… 如果出現其他的表示沒有啟用成功
PS C:\> wsl --set-default-version 2
有關 WSL 2 的主要差異詳細資訊,請瀏覽 https://aka.ms/wsl2
我是下載Ubuntu 20.04 這個版本
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.zip -UseBasicParsing
Expand-Archive .\Ubuntu.zip .\Ubuntu
PS C:\> cd .\Ubuntu\
PS C:\Ubuntu> .\ubuntu2004.exe
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username:
New password:
Retype new password:
passwd: password updated successfully
輸入exit 就會離開linux
PS C:\Ubuntu> wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
參考資料
1.Enable the Windows Subsystem for Linux
2.Windows 10 上適用於 Linux 的 Windows 子系統安裝指南
Windows Server Core
Windows Server 2004
WSL2
借用保哥的範例:https://blog.miniasp.com/post/2021/09/02/Batch-replace-Office-365-to-Microsoft-365-License-using-PowerShell 只是保哥的例子,不是完整的範例,借這篇把內容補齊而己 安裝 AzureAD Module 系統管理員身分執行 PowerShell 命令提示字元視窗。 執行︰ Install-Module -Name AzureAD
Oct 5, 2021先到IP的組態裡幫IP設個DNS名稱 DNS 名稱標籤 (選用): 選一個可以代表這個IP功用的名字。Azure 會自動加上尾碼。 設定 ReverseFqdn。由於 UI 上並沒有提供設定的功能,所以要使用Azure Powershell來設定。 $pip = Get-AzPublicIpAddress -Name "Public的名字" -ResourceGroupName "ResourceGroup的名字" $pip.DnsSettings.ReverseFqdn = "www.domain.com." #這裡注意fqdn最後要有個. Set-AzPublicIpAddress -PublicIpAddress $pip
Sep 13, 2021今天想要修改Server Core VM的IP,但是使用sconfig卻看不到我想要修改的網卡。 Microsoft (R) Windows Script Host Version 5.812 Copyright (C) Microsoft Corp. 1996-2006, 著作權所有,並保留一切權利 正在檢查系統... =============================================================================== 伺服器設定 ===============================================================================
May 25, 2021情境 當使用指令 docker service logs [service name] 要讀取log時,如果發生下列錯誤。 error from daemon in stream: Error grabbing logs: rpc error: code = Unknown desc = warning: incomplete log stream. some logs could not be retrieved for the following reasons: node XXXXXXXXXXXXXXXXXXXXXXXXXXXXX is not available 這似乎是docker 的bug ,在2017年就有人在docker的官方github發這個issue,但是到今天(2021年3月,版本19.03.14)為止都還沒解決。 看起來,把host重新開機或者把Service 移除再重新部署都沒有辦法。 解決方法
Feb 26, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up