博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pxe ubuntu_如何从Windows Server 2008 PXE引导Ubuntu映像
阅读量:2510 次
发布时间:2019-05-11

本文共 16471 字,大约阅读时间需要 54 分钟。

pxe ubuntu

pxe ubuntu

image

This guide explains how to configure a Windows Server 2008 machine to push out a static Ubuntu image that can be picked up by diskless terminals, so that you can have any number of machines running a fully-functional instance of Ubuntu without having a hard drive, as long as they are capable of PXE booting.

本指南说明了如何配置Windows Server 2008计算机以推出可以由无盘终端拾取的静态Ubuntu映像,以便您可以使任何数量的计算机在不使用硬盘的情况下运行功能齐全的Ubuntu实例,只要它们能够启动PXE。

This is a guest article by Alexander Karnitis and Cody Dull, two readers that work for Hyndman Inc and had to figure out how to accomplish this task for their job. They were kind enough to write up the process for everybody else.

这是Alexander Karnitis和Cody Dull的客座文章,这两位读者在Hyndman Inc工作,不得不弄清楚如何完成这项工作。 他们很友善,可以为其他人制定流程。

我为什么要这个? (Why do I want this?)

PXE booting makes it both easier and cheaper to manage a network, and the ability to serve custom Ubuntu images from a Windows Server can help make your environment more robust. You can use these images to give users the same basic environment to work from, have an easily-restorable system (just power-cycle the machine), perform diagnostics on a malfunctioning machine, and more. Also, by serving these images from a Windows Server, it would be possible to serve both Windows and Ubuntu images from a single location, though that is beyond the scope of this guide.

PXE引导使管理网络变得既容易又便宜,并且能够从Windows Server提供自定义Ubuntu映像的功能有助于使您的环境更加强大。 您可以使用这些图像为用户提供相同的基本工作环境,具有易于恢复的系统(只需对机器重新通电),对有故障的机器进行诊断等等。 另外,通过Windows Server提供这些映像,可以从一个位置提供Windows和Ubuntu映像,但这不在本指南的范围之内。

我需要什么? (What do I need?)

  • Windows Server 2008 Machine running Windows Deployment Services (WDS)

    运行Windows部署服务(WDS)的Windows Server 2008计算机
  • Client capable of PXE booting

    能够进行PXE引导的客户端
  • Windows Server Machine running DHCP

    Windows Server计算机运行DHCP
  • An NFS server (this guide assumes that the NFS server is the same as the WDS server, but that doesn’t have to be the case)

    NFS服务器(本指南假定NFS服务器与WDS服务器相同,但不一定要这样)

创建WDS服务器 (Creating the WDS Server)

Installing Windows Deployment Services on a windows server isn’t terribly difficult, and Microsoft has great guides to walk you through the installation process (2008 and 2008 R2 ), so this guide won’t cover how to do that, but know that you want both the Deployment Server and Transport server. Also note that when configuring the role, you’ll want to check the box “Respond to all (known and unknown) client computers” during the setup, unless the computers that you are booting are already known to Active Directory. This is because the server refers to Active Directory as the authority on what are known and unknown devices.

在Windows服务器上安装Windows部署服务并不是很困难,Microsoft提供了很好的指南来指导您完成安装过程( 2008和2008 R2),因此本指南将不介绍如何进行安装,但是您知道同时需要Deployment Server和Transport Server。 另请注意,在配置角色时,除非安装了Active Directory已知要启动的计算机,否则您将在安装过程中选中“响应所有(已知和未知)客户端计算机”框。 这是因为服务器将Active Directory称为已知设备和未知设备上的权限。

image001[4]

The guide should be followed up until the “Steps for adding images” section, as we will be adding our images through pxelinux, not WDS.

该指南应一直到“添加图像的步骤”部分为止,因为我们将通过pxelinux而不是WDS添加图像。

安装pxelinux (Installing pxelinux)

Download and extract a copy of syslinux (one possible source is ). From here, we’re going to be copying the files that pxelinux needs to run over into the WDS directory. Specifically, for pxelinux 5.01, that means that we’ll be copying over the following files:

下载并解压缩syslinux的副本( 是一个可能的来源)。 从这里,我们将把pxelinux需要运行的文件复制到WDS目录中。 具体来说,对于pxelinux 5.01,这意味着我们将复制以下文件:

· Core\pxelinux.0

·Core \ pxelinux.0

· Com32\menu\vesamenu.c32

·Com32 \ menu \ vesamenu.c32

· Com32\lib\libcom32.c32

·Com32 \ lib \ libcom32.c32

· Com32\elflink\ldlinux.c32

·Com32 \ elflink \ ldlinux.c32

· Com32\libutil\libutil.c32

·Com32 \ libutil \ libutil.c32

· Com32\chain\chain.c32

·Com32 \ chain \ chain.c32

These files will be copied over into the desired architecture directory (\boot\x64, \boot\x86, or both). After copying the files, the architecture directory should look similar to this (there are slight differences between x86 and x64, but not for pxelinux).

这些文件将被复制到所需的体系结构目录(\ boot \ x64,\ boot \ x86或两者)中。 复制文件后,体系结构目录应与此相似(x86和x64之间略有差异,但pxelinux则没有)。

image002[6]

Here, the architecture directories are located under the directory that was specified to hold the WDS files when customizing the WDS role.

在这里,体系结构目录位于自定义WDS角色时指定用于保存WDS文件的目录下。

At this point, we will have no more use for any other syslinux files, so the syslinux directory can safely be removed.

此时,我们将不再使用任何其他syslinux文件,因此可以安全地删除syslinux目录。

配置PXElinux (Configuring PXElinux)

The pxelinux config file can be heavily customized to provide a unique boot menu for different computers based on a hardware type and hardware address, or based on an IP address or range of IP addresses (more on that ), and can provide quite a few boot methods and a fairly robust menu system (more on that ). For the purposes of this basic guide, however, we’ll stick to the default config file and explain the basic menu that can be used to pxeboot a liveCD. To start with, the config files need to be located in a sub-folder named “pxelinux.cfg”, so create that folder in the same directory that you copied over the pxelinux files to. We also created an “Images” folder alongside the pxelinux.cfg folder to store all of our linux images. At this point, the architecture folder should look something like this:

可以大量自定义pxelinux配置文件,以根据硬件类型和硬件地址,或者基于IP地址或IP地址范围(在提供更多 )为不同的计算机提供唯一的启动菜单,并且可以提供很多引导方法和一个相当强大的菜单系统(有关更多信息,请 )。 但是,出于本基本指南的目的,我们将坚持使用默认配置文件,并说明可用于pxeboot liveCD的基本菜单。 首先,配置文件必须位于名为“ pxelinux.cfg”的子文件夹中,因此请在您将pxelinux文件复制到的同一目录中创建该文件夹。 我们还在pxelinux.cfg文件夹旁边创建了一个“ Images”文件夹,以存储我们所有Linux映像。 此时,体系结构文件夹应如下所示:

image003[4]

Now, in the pxelinux.cfg folder, create a file called “default” without a file extension.

现在,在pxelinux.cfg文件夹中,创建一个没有文件扩展名的名为“ default”的文件。

Open the file in a text editor like notepad and type the following:

在文本编辑器(如记事本)中打开文件,然后键入以下内容:

DEFAULT vesamenu.c32
PROMPT 0
NOESCAPE 0
ALLOWOPTIONS 0

DEFAULT vesamenu.c32
PROMPT 0
NOESCAPE 0
ALLOWOPTIONS 0

# Timeout in units of 1/10 s

# Timeout in units of 1/10 s

TIMEOUT 30 #3 second timeout. MENU MARGIN 10 MENU ROWS 16 MENU TABMSGROW 21 MENU TIMEOUTROW 26 MENU COLOR BORDER 30;44 #20ffffff #00000000 none MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none MENU COLOR TITLE 0 #ffffffff #00000000 none MENU COLOR SEL 30;47 #40000000 #20ffffff MENU TITLE Netboot Menu

TIMEOUT 30 #3 second timeout. MENU MARGIN 10 MENU TABMSGROW 21 MENU MARGIN 10 MENU ROWS 16 MENU TABMSGROW 21 MENU TIMEOUTROW 26 MENU COLOR BORDER 30;44 #20ffffff #00000000 none MENU TIMEOUTROW 26 MENU COLOR BORDER 30;44 #20ffffff #00000000 none MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none MENU COLOR TITLE 0 #ffffffff #00000000 none MENU COLOR SEL 30;47 #40000000 #20ffffff MENU TITLE Netboot Menu

#-A sample liveCD boot

#-A sample liveCD boot

LABEL <Label Name>

LABEL <Label Name>

kernel Images/UbuntuLIVE/casper/vmlinuz #location of the kernel

kernel Images/UbuntuLIVE/casper/vmlinuz #location of the kernel

append boot=casper netboot=nfs nfsroot=<Windows Server IP>:/RemoteInstall/Boot/x64/Images/UbuntuLIVE initrd=Images/UbuntuLIVE /casper/initrd.gz

append boot=casper netboot=nfs nfsroot=<Windows Server IP>:/RemoteInstall/Boot/x64/Images/UbuntuLIVE initrd=Images/UbuntuLIVE /casper/initrd.gz

Note that this setup is assuming that the image is stored under Images/UbuntuLIVE from the architecture directory.

请注意,此设置假定图像存储在体系结构目录的Images / UbuntuLIVE下。

For more information on what this is doing, you can look at:

有关此操作的更多信息,请查看:

创建一个NFS共享 (Creating an NFS share)

Creating an NFS share is pretty simple on Windows server as well, and can be done by following the steps . There are a few things to note with regards to Permissions, however.

在Windows服务器上创建NFS共享也非常简单,可以按照的步骤进行操作。 但是,关于权限,需要注意一些事项。

First, NTFS permissions on the share folder are going to have to be changed, as the Everyone group will need to have Read and Execute permissions.

首先,将必须更改共享文件夹上的NTFS权限,因为Everyone组将需要具有读取和执行权限。

image005[4]
image006[4]

Make sure that the share created is an NFS share, not an SMB share.

确保创建的共享是NFS共享,而不是SMB共享。

image008[4]

Also, all machines will need to have anonymous access, and the Everyone NTFS permissions will need to be applied to anonymous users.

同样,所有计算机都将需要具有匿名访问权限,每个人的NTFS权限都需要应用于匿名用户。

image010[4]
image011[4]

Once everything is set up, it might still take a while for all of the settings to propagate through the network, but once they do it should be possible to start serving LiveCD’s from your Windows Server box! To test the server, you can share a simple LiveCD taken from Ubuntu’s website. However, it is also possible to serve up a customized LiveCD. If you are planning to do some basic configuration to the LiveCD, you can follow the article:

一旦完成所有设置,所有设置可能仍需要一段时间才能通过网络传播,但是一旦完成,就可以从Windows Server盒开始提供LiveCD了! 要测试服务器,您可以共享从Ubuntu网站获取的简单LiveCD。 但是,也可以提供定制的LiveCD。 如果您打算对LiveCD进行一些基本配置,则可以阅读以下文章:

However, if you want to do some more intense customization like tweaking Unity, which can’t be done well using the above method, or if you want to take a simple machine and serve up identical copies of it, another fairly simple method that will allow you to make an image that can be served is as follows:

但是,如果您想做一些更强烈的定制,例如调整Unity,使用上述方法无法很好地完成,或者如果您想使用一台简单的机器并提供相同的副本,则另一种相当简单的方法将允许您制作可投放的图片,如下所示:

创建和自定义Ubuntu Live CD (Creating and Customizing Your Ubuntu Live CD)

Creating a new custom image is easy. Download and install a virtual machine player if you don’t already have one. The steps in this guide are for Oracle VM VirtualBox.

创建新的自定义图像很容易。 如果没有虚拟机播放器,请下载并安装它。 本指南中的步骤适用于Oracle VM VirtualBox。

Create a new virtual machine, select Linux as the Type and Ubuntu or Ubuntu(64 bit) as the Version, depending on your preference, click Next.

创建一个新的虚拟机,选择Linux作为Type,选择Ubuntu或Ubuntu(64 bit)作为Version,根据您的偏好,单击Next。

image013[4]

Select the amount of memory to be allocated, at least 1024 MB is recommended, click Next.

选择要分配的内存量,建议至少1024 MB,然后单击“下一步”。

image015[4]

Choose to create a new virtual hard drive now of type VDI and make it dynamically allocated.

选择立即创建一个VDI类型的新虚拟硬盘驱动器,并对其进行动态分配。

image017[4]
image019[4]
image021[4]
image023[4]

Finally, set the size of the virtual hard drive. 4 GB is the minimum, but 6-8 GB is recommended.

最后,设置虚拟硬盘驱动器的大小。 最低4 GB,但建议6-8 GB。

Download Ubuntu 12.04 LTS Live CD from Ubuntu’s website. Make sure you select the same version you selected in step 2.

从Ubuntu网站下载Ubuntu 12.04 LTS Live CD。 确保选择在步骤2中选择的相同版本

Go to the settings of the VM you just created. Under Storage, click the single disk under Controller: IDE. On the right of the screen under Attributes, click the disk with an arrow next to the field CD/DVD Drive. Click Choose a virtual file. Navigate to where you downloaded the Live CD and select it.

转到刚刚创建的VM的设置。 在“存储”下,单击“ 控制器:IDE”下的单个磁盘。 在屏幕右侧的“ 属性”下,单击CD / DVD驱动器字段旁边的带有箭头的磁盘。 单击选择虚拟文件 。 浏览至下载Live CD的位置并选择它。

image025[4]

You can now start the VM and install Ubuntu 12.04.

现在,您可以启动VM并安装Ubuntu 12.04。

Once installed, make all desired changes. Some of the changes that we did include:

安装后,进行所有所需的更改。 我们所做的一些更改包括:

  • If this is going to be used by anyone except system admins, create a User account as a standard user, set it to log in automatically with no password required.

    如果除系统管理员之外的任何人都将使用此帐户,请以标准用户身份创建用户帐户,并将其设置为无需密码即可自动登录。
  • Remove any unnecessary programs depending on the purpose of the final image. Some larger programs that can be removed if not needed are: Firefox, LibreOffice, Gwibber, Thunderbird, empathy, and any games. You may do this are by using the aptitude purge <program name> command in terminal, or by installing Synaptic Package Manager from the Ubuntu Software Center.

    根据最终图像的目的删除所有不必要的程序。 如果不需要,可以删除一些较大的程序:Firefox,LibreOffice,Gwibber,Thunderbird,同理心和任何游戏。 您可以通过在终端中使用aptitude purge <程序名称>命令或通过从Ubuntu软件中心安装Synaptic软件包管理器来执行此操作。

  • Under Startup Applications, create an entry for any program you want to run at start time. For example, if these machines will be used mainly for remote desktop connections, set Remmina Remote Desktop to auto start.

    在“ 启动应用程序”下 ,为任何程序创建一个条目 您想在开始时运行。 例如,如果这些计算机主要用于远程桌面连接,请将Remmina Remote Desktop设置为自动启动。

  • To change the default resolution, create a file that will run the xrandr command.

    要更改默认分辨率,请创建一个将运行xrandr命令的文件。

    • An example script that we used to turn off the integrated display on our thin clients and change the resolution of the attached monitors was the following two lines:

      以下两行是我们用来关闭瘦客户机上的集成显示器并更改所连接显示器的分辨率的示例脚本:

      xrandr --output LVDS1 –offx

      xrandr --output LVDS1 –offx

      randr --output VGA1 --primary --mode 1280x1024

      randr --output VGA1 --primary --mode 1280x1024

    • Make the file executable and add it to Startup Applications.

      使文件可执行,并将其添加到“ 启动应用程序”

    • Additional commands can be run at start time using this method.

      使用此方法可以在启动时运行其他命令。
    • Keep in mind that this will only work if all of your machines label their displays similarly. If you have multiple models, a more sophisticated approach may be necessary.

      请记住,这仅在所有机器都在其显示器上贴上相似标签的情况下才有效。 如果您有多个模型,则可能需要更复杂的方法。
  • Unlock any remaining icons from the launcher that don’t need to be there, and add any you wish to add.

    从启动器中解锁所有不需要的剩余图标,然后添加您想要添加的任何图标。

After making all customizations, you must install Remastersys. Despite some posts you may find on forums, Remastersys is still up and running.

进行所有自定义之后,必须安装Remastersys 。 尽管您可以在论坛上找到一些帖子,但是Remastersys仍然可以正常运行。

  • Get Synaptic Package Manager by either entering sudo apt-get install synaptic at the terminal or get it from Ubuntu Software Center.

    通过在终端输入sudo apt-get install synaptic或从Ubuntu Software Center获取它来获取Synaptic软件包管理器

  • Run the following command in terminal to download the repository gpg key:

    在终端中运行以下命令以下载存储库gpg密钥:

    sudo wget –O –http://www.remastersys.com/Ubuntu/remastersys.gpg.key | apt-key add –

    sudo wget –O –http://www.remastersys.com/Ubuntu/remastersys.gpg.key | apt-key add –

  • Open the file /etc/apt/sources.list in a text editor with sudo rights, append the following line, changing precise to your version if necessary:deb http://www.remastersys.com/ubuntu precise main

    在具有sudo权限的文本编辑器中打开文件/etc/apt/sources.list ,添加以下行,并根据需要将精确更改为您的版本:deb http://www.remastersys.com/ubuntu precision main

  • Open Synaptic and search for Remastersys. Mark the packages Remastersys and Remastersys-gui to be installed, press apply to install.

    打开Synaptic并搜索Remastersys 。 标记要安装的软件包RemastersysRemastersys-gui ,然后按Apply(应用)进行安装。

  • Open Remastersys-gui and select Backup.

    打开Remastersys-gui并选择Backup

You now have a custom live cd. The next step is to transfer it over to your server. If you have followed the <link>Configuring Windows Server 2008 to PXE boot Ubuntu</link> guide, here are the steps to deploy the image.

您现在有了一个定制的现场CD。 下一步是将其转移到您的服务器上。 如果您已遵循<link>将Windows Server 2008配置为PXE引导Ubuntu </ link>指南,请按照以下步骤部署映像。

  • Execute the following command in terminal to make the Ubuntu VM an NFS client. sudo apt-get install rpcbind nfs-common

    在终端中执行以下命令以使Ubuntu VM成为NFS客户端。 须藤apt-get install rpcbind nfs-common

  • Create a directory to mount the NFS share on. sudo mkdir /NFS

    创建一个目录以挂载NFS共享。 须藤mkdir / NFS

  • You must now mount an NFS share with write permissions granted. It is recommended that you create an additional share for the purpose of transferring files from client to server as you share, for the pxe boot file system won’t typically have this permission.

    现在,您必须安装已授予写许可权的NFS共享。 建议您创建一个额外的共享,以便在共享时将文件从客户端传输到服务器,因为pxe引导文件系统通常没有此权限。

    sudo mount <ip address of server>:/<NFS Name> /NFSex. sudo mount 192.168.1.24:/TempNFS /NFS

    sudo mount <服务器的IP地址>:/ <NFS名称> / NFS 例如 须藤安装192.168.1.24:/TempNFS / NFS

  • Copy the newly created iso to the mounted share

    将新创建的iso复制到已安装的共享中

    sudo cp /home/remastersys/remastersys/custom-back.iso /NFS

    须藤cp /home/remastersys/remastersys/custom-back.iso / NFS

  • At this point, you are done with the Ubuntu VM. On your windows server, go to where the iso was copied and extract the contents using an image file processing tool such as Power ISO.

    至此,您已经完成了Ubuntu VM。 在Windows服务器上,转到iso的复制位置,然后使用图像文件处理工具(例如Power ISO)提取内容。

  • Create a folder under <share root>/boot/x64/Images and copy the contents of the iso into this folder.

    在<share root> / boot / x64 / Images下创建一个文件夹,并将iso的内容复制到该文件夹​​中。
  • If your server is properly configured, you should now see your customized Ubuntu Live CD as one of the pxe boot options when you boot you diskless client.

    如果服务器配置正确,则在引导无盘客户端时,现在应该将自定义的Ubuntu Live CD视为pxe引导选项之一。

    image027[4]

To change the custom image, go back to the VM and repeat the steps from above starting at the step where you chose the disk image to boot from. This time, instead of using the default cd downloaded from Ubuntu, you will use the backup iso file you exported.

要更改自定义映像,请返回到VM并从上面选择要从其启动磁盘映像的步骤开始,重复上述步骤。 这次,您将使用导出的备份iso文件,而不是使用从Ubuntu下载的默认CD。

翻译自:

pxe ubuntu

转载地址:http://vnjwd.baihongyu.com/

你可能感兴趣的文章
centos6.5安装pip方法
查看>>
WCF常用绑定选择
查看>>
OGRE COMMAND-LINE UTILITIES
查看>>
IO:in、out和err
查看>>
Linux记录-使用python临时搭建web服务器
查看>>
日期转换为新数据类型CONVERT() 函数
查看>>
C#设计模式之十外观模式(Facade Pattern)【结构型】
查看>>
Redis进阶实践之十五 Redis-cli命令行工具使用详解第二部分(结束)
查看>>
Git使用gitignore建立项目过滤规则
查看>>
Can you solve this equation?
查看>>
经典算法50题
查看>>
广义距离变换
查看>>
2019年Q1总结+Q2大体规划
查看>>
struts2常用标签
查看>>
初次学习CentOS需要注意的问题
查看>>
初学C#之方法
查看>>
[Kubernetes]深入理解StatefulSet
查看>>
2018.2.2 java中的Date如何获取 年月日时分秒
查看>>
基础知识回顾:闭包
查看>>
luogu P1602 Sramoc问题
查看>>