Nano Server 快速入門Nano Server Quick Start

適用於︰Windows Server 2016Applies To: Windows Server 2016

重要

從 Windows Server 版本 1709 開始,Nano Server 僅以容器基礎 OS 映像的形式來提供。Starting in Windows Server, version 1709, Nano Server will be available only as a container base OS image. 請查看 Nano Server 的變更以了解這代表的意義。Check out Changes to Nano Server to learn what this means.

遵循本節中的步驟即可使用 DHCP 取得 IP 位址,以快速開始進行 Nano Server 的基本部署。Follow the steps in this section to get started quickly with a basic deployment of Nano Server using DHCP to obtain an IP address. 您可以在虛擬機器中執行 Nano Server VHD,或在實體電腦上開機到此 VHD;這兩者的步驟稍有不同。You can run a Nano Server VHD either in a virtual machine or boot to it on a physical computer; the steps are slightly different.

當您透過這些快速入門步驟試用基本概念之後,您可以在部署 Nano Server 中找到有關建立您自己的映像、透過幾個方法建立套件管理、網域作業等詳細資訊。Once you've tried out the basics with these quick-start steps, you can find details of creating your own custom images, package management by several methods, domain operations, and much more in Deploy Nano Server.

虛擬機器中的 Nano ServerNano Server in a virtual machine

請遵循下列步驟,建立將在虛擬機器中執行的 Nano Server VHD。Follow these steps to create a Nano Server VHD that will run in a virtual machine.

在虛擬機器中快速部署 Nano ServerTo quickly deploy Nano Server in a virtual machine

  1. NanoServerImageGenerator 資料夾從 Windows Server 2016 ISO 中的 \NanoServer 資料夾複製到您硬碟上的資料夾。Copy NanoServerImageGenerator folder from the \NanoServer folder in the Windows Server 2016 ISO to a folder on your hard drive.

  2. 以系統管理員身分啟動 Windows PowerShell,將目錄變更為您放置 NanoServerImageGenerator 資料夾的資料夾,然後使用下列命令匯入模組:Start Windows PowerShell as an administrator, change directory to the folder where you have placed the NanoServerImageGenerator folder and then import the module with Import-Module .\NanoServerImageGenerator -Verbose

    注意

    您可能需要調整 Windows PowerShell 執行原則。You might have to adjust the Windows PowerShell execution policy. Set-ExecutionPolicy RemoteSigned 應該適用。should work well.

  3. 執行下列命令為 Standard Edition 建立設定電腦名稱並包含 Hyper-V 客體驅動程式的 VHD,該命令會提示您輸入新 VHD 的系統管理員密碼:Create a VHD for the Standard edition that sets a computer name and includes the Hyper-V guest drivers by running the following command which will prompt you for an administrator password for the new VHD:

    New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath <path to root of media> -BasePath .\Base -TargetPath .\NanoServerVM\NanoServerVM.vhd -ComputerName <computer name> wherewhere

    • -MediaPath <媒體的根目錄路徑> 指定 Windows Server 2016 ISO 內容的根目錄路徑。-MediaPath <path to root of media> specifies a path to the root of the contents of the Windows Server 2016 ISO. 例如,如果您已將 ISO 內容複製到 d:\TP5ISO,您將使用該路徑。For example if you have copied the contents of the ISO to d:\TP5ISO you would use that path.

    • -BasePath (選擇性) 指定將要建立以複製 Nano Server WIM 和套件的目的地資料夾。-BasePath (optional) specifies a folder that will be created to copy the Nano Server WIM and packages to.

    • -TargetPath 指定將要建立產生之 VHD 或 VHDX 的路徑,其中包含檔名和副檔名。-TargetPath specifies a path, including the filename and extension, where the resulting VHD or VHDX will be created.

    • Computer_name 指定您要建立之 Nano Server 虛擬機器將具有的電腦名稱。Computer_name specifies the computer name that the Nano Server virtual machine you are creating will have.

    範例:Example: New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath f:\ -BasePath .\Base -TargetPath .\Nano1\Nano.vhd -ComputerName Nano1

    此範例會從掛接為 f:\ 的 ISO 建立 VHD。This example creates a VHD from an ISO mounted as f:\. 建立 VHD 時,它會使用您執行 New-NanoServerImage 所在的相同目錄中稱為 Base 的資料夾;它會將 VHD (稱為 Nano.vhd) 放在執行命令的來源資料夾中稱為 Nano1 的資料夾。When creating the VHD it will use a folder called Base in the same directory where you ran New-NanoServerImage; it will place the VHD (called Nano.vhd) in a folder called Nano1 in the folder from where the command is run. 電腦名稱會是 Nano1。The computer name will be Nano1. 產生的 VHD 將會包含 Windows Server 2016 Standard Edition,並且適用於 Hyper-V 虛擬機器部署。The resulting VHD will contain the Standard edition of Windows Server 2016 and will be suitable for Hyper-V virtual machine deployment. 如果您需要第 1 代虛擬機器,請為 -TargetPath 指定 .vhd 副檔名來建立 VHD 映像。If you want a Generation 1 virtual machine, create a VHD image by specifying a .vhd extension for -TargetPath. 針對第 2 代虛擬機器,請為 -TargetPath 指定 .vhdx 副檔名來建立 VHDX 映像。For a Generation 2 virtual machine, create a VHDX image by specifying a .vhdx extension for -TargetPath. 您也可以為 -TargetPath 指定 .wim 副檔名來直接產生 WIM 檔案。You can also directly generate a WIM file by specifying a .wim extension for -TargetPath.

    注意

    Windows 8.1、Windows 10、Windows Server 2012 R2 和 Windows Server 2016 支援 New-NanoServerImage。New-NanoServerImage is supported on Windows 8.1, Windows 10, Windows Server 2012 R2, and Windows Server 2016.

  4. 在 Hyper-V 管理員中,建立新的虛擬機器並使用步驟 3 中所建立的 VHD。In Hyper-V Manager, create a new virtual machine and use the VHD created in Step 3.

  5. 啟動虛擬機器,然後在 Hyper-V 管理員中連線到虛擬機器。Boot the virtual machine and in Hyper-V Manager connect to the virtual machine.

  6. 使用您在步驟 3 中執行指令碼時所提供的系統管理員和密碼來登入修復主控台 (請參閱本指南中的<Nano Server 修復主控台>一節)。Log on to the Recovery Console (see the "Nano Server Recovery Console" section in this guide), using the administrator and password you supplied while running the script in Step 3.

    注意

    修復主控台只支援基本鍵盤功能。The Recovery Console only supports basic keyboard functions. 不支援鍵盤背光、10 個按鍵區段和鍵盤配置切換 (例如 Caps Lock 和 Number Lock)。Keyboard lights, 10-key sections, and keyboard layout switching such as caps lock and number lock are not supported.

  7. 取得 Nano Server 虛擬機器的 IP 位址,並使用 Windows PowerShell 遠端執行功能或其他遠端管理工具來連線到虛擬機器及從遠端進行管理。Obtain the IP address of the Nano Server virtual machine and use Windows PowerShell remoting or other remote management tool to connect to and remotely manage the virtual machine.

實體電腦上的 Nano ServerNano Server on a physical computer

您也可以使用預先安裝的裝置驅動程式,建立將要在實體電腦上執行 Nano Server 的 VHD。You can also create a VHD that will run Nano Server on a physical computer, using the pre-installed device drivers. 如果您的硬體為了開機或連線到網路所需的驅動程式尚未提供,請遵循本指南之<新增其他驅動程式>一節中的步驟。If your hardware requires a driver that is not already provided in order to boot or connect to a network, follow the steps in the "Adding Additional Drivers" section of this guide.

在實體電腦上快速部署 Nano ServerTo quickly deploy Nano Server on a physical computer

  1. NanoServerImageGenerator 資料夾從 Windows Server 2016 ISO 中的 \NanoServer 資料夾複製到您硬碟上的資料夾。Copy NanoServerImageGenerator folder from the \NanoServer folder in the Windows Server 2016 ISO to a folder on your hard drive.

  2. 以系統管理員身分啟動 Windows PowerShell,將目錄變更為您放置 NanoServerImageGenerator 資料夾的資料夾,然後使用下列命令匯入模組:Start Windows PowerShell as an administrator, change directory to the folder where you have placed the NanoServerImageGenerator folder and then import the module with Import-Module .\NanoServerImageGenerator -Verbose

注意

您可能需要調整 Windows PowerShell 執行原則。You might have to adjust the Windows PowerShell execution policy. Set-ExecutionPolicy RemoteSigned 應該適用。should work well.

  1. 執行下列命令來建立設定電腦名稱並包含 OEM 驅動程式和 Hyper-V 的 VHD,該命令會提示您輸入新 VHD 的系統管理員密碼:Create a VHD that sets a computer name and includes the OEM drivers and Hyper-V by running the following command which will prompt you for an administrator password for the new VHD:

    New-NanoServerImage -Edition Standard -DeploymentType Host -MediaPath <path to root of media> -BasePath .\Base -TargetPath .\NanoServerPhysical\NanoServer.vhd -ComputerName <computer name> -OEMDrivers -Compute -Clustering wherewhere

    • -MediaPath <媒體的根目錄路徑> 指定 Windows Server 2016 ISO 內容的根目錄路徑。-MediaPath <path to root of media> specifies a path to the root of the contents of the Windows Server 2016 ISO. 例如,如果您已將 ISO 內容複製到 d:\TP5ISO,您將使用該路徑。For example if you have copied the contents of the ISO to d:\TP5ISO you would use that path.

    • -BasePath 指定將要建立以複製 Nano Server WIM 和套件的目的地資料夾BasePath specifies a folder that will be created to copy the Nano Server WIM and packages to. (此為選擇性參數)。(This parameter is optional.)

    • TargetPath 指定將要建立產生之 VHD 或 VHDX 的路徑,其中包含檔名和副檔名。TargetPath specifies a path, including the filename and extension, where the resulting VHD or VHDX will be created.

    • Computer_name 是您要建立之 Nano Server 的電腦名稱。Computer_name is the computer name for the Nano Server you are creating.

    範例:Example:New-NanoServerImage -Edition Standard -DeploymentType Host -MediaPath F:\ -BasePath .\Base -TargetPath .\Nano1\NanoServer.vhd -ComputerName Nano-srv1 -OEMDrivers -Compute -Clustering

    此範例會從掛接為 F:\ 的 ISO 建立 VHD。This example creates a VHD from an ISO mounted as F:\. 建立 VHD 時,它會使用您執行 New-NanoServerImage 所在的相同目錄中稱為 Base 的資料夾;它會將 VHD 放在執行命令的來源資料夾中稱為 Nano1 的資料夾。When creating the VHD it will use a folder called Base in the same directory where you ran New-NanoServerImage; it will place the VHD in a folder called Nano1 in the folder from where the command is run. 電腦名稱會是 Nano-srv1,而且會安裝最常見硬體的 OEM 驅動程式、啟用 Hyper-V 角色和叢集功能,The computer name will be Nano-srv1 and will have OEM drivers installed for most common hardware and has the Hyper-V role and clustering feature enabled. 並使用標準 Nano 版本。The Standard Nano edition is used.

  2. 以系統管理員身分登入您要執行 Nano Server VHD 的實體伺服器。Log in as an administrator on the physical server where you want to run the Nano Server VHD.

  3. 將此指令碼建立的 VHD 複製到實體電腦,並將它設定為從這個新的 VHD 開機。Copy the VHD that this script creates to the physical computer and configure it to boot from this new VHD. 若要這樣做,請遵循下列步驟:To do that, follow these steps:

    1. 掛接產生的 VHD。Mount the generated VHD. 在此範例中是掛接在 D:\ 下。In this example, it's mounted under D:\.

    2. 執行 bcdboot d:\windowsRun bcdboot d:\windows.

    3. 取消掛接 VHD。Unmount the VHD.

  4. 將實體電腦開機到 Nano Server VHD。Boot the physical computer into the Nano Server VHD.

  5. 使用您在步驟 3 中執行指令碼時所提供的系統管理員和密碼來登入修復主控台 (請參閱本指南中的<Nano Server 修復主控台>一節)。Log on to the Recovery Console (see the "Nano Server Recovery Console" section in this guide), using the administrator and password you supplied while running the script in Step 3.

    注意

    修復主控台只支援基本鍵盤功能。The Recovery Console only supports basic keyboard functions. 不支援鍵盤背光、10 個按鍵區段和鍵盤配置切換 (例如 Caps Lock 和 Number Lock)。Keyboard lights, 10-key sections, and keyboard layout switching such as caps lock and number lock are not supported.

  6. 取得 Nano Server 電腦的 IP 位址,並使用 Windows PowerShell 遠端執行功能或其他遠端管理工具來連線到虛擬機器及從遠端進行管理。Obtain the IP address of the Nano Server computer and use Windows PowerShell remoting or other remote management tool to connect to and remotely manage the virtual machine.