如何网络引导(PXE)Ubuntu LiveCD

Colored-1920x1200 [DesktopNexus.com]

With Ubuntu’s latest release out the door, we thought we’d celebrate by showing you how to make it centrally available on your network by using network boot (PXE).

随着Ubuntu最新版本的问世,我们想通过向您展示如何使用网络启动(PXE)使它在网络上集中可用来庆祝。

总览 (Overview)

We already showed you how to setup a PXE server in the “What Is Network Booting (PXE) and How Can You Use It?” guide, in this guide we will show you how to add the Ubuntu LiveCD to the boot options.

我们已经在“ 什么是网络引导(PXE)以及如何使用它 ”中向您展示了如何设置PXE服务器 ”指南,在本指南中,我们将向您展示如何将Ubuntu LiveCD添加到引导选项。

If you are not already using Ubuntu as your number one “go to” for troubleshooting, diagnostics and rescue procedures tool… it will probably replace all of the tools you are currently using. Also, once the machine has booted into the Ubuntu live session, it is possible to perform the OS setup like you normally would. The immediate up shut of using Ubuntu over the network, is that if your already using the CD version, you will never again be looking for the CDs you forgot in the CD drives.

如果您尚未将Ubuntu用作故障排除,诊断和救援程序工具的“首选”,它可能会取代您当前正在使用的所有工具。 此外,一旦计算机启动进入Ubuntu实时会话,就可以像通常那样执行操作系统设置。 通过网络使用Ubuntu的直接后果是,如果您已经在使用CD版本,那么您将再也不会在CD驱动器中寻找忘记的CD。

Image by Dryope.

图片由Dryope提供

先决条件 (Prerequisites)

  • It is assumed that you have already setup the FOG server as explained in our “What Is Network Booting (PXE) and How Can You Use It?” guide.

    假定您已经按照我们的“ 什么是网络引导(PXE)和如何使用它 ”中的说明安装了FOG服务器 指南。

  • All the prerequisites for the FOG setup guide apply here as well.

    FOG设置指南的所有前提条件也适用于此。
  • This procedure has been used to make Ubuntu 9.10 (Karmic Koala) up to and including 11.04 (Natty Narwhal) network bootable. It may work for other Ubuntu like distributions (like Linux Mint) but hasn’t been tested.

    该过程已用于使Ubuntu 9.10( Karmic Koala )达到11.04( Natty Narwhal )网络(包括该网络)可启动。 它可能适用于其他类似Ubuntu的发行版(例如Linux Mint),但尚未经过测试。

  • You will see me use VIM as the editor program, this is just because I’m used to it… you may use any other editor that you’d like.

    您会看到我将VIM用作编辑器程序,这仅仅是因为我已经习惯了……您可以使用任何其他想要的编辑器。

How does it work?In general the Ubuntu LiveCD boot process that we all know is like so:

它是如何工作的? 通常,众所周知,Ubuntu LiveCD引导过程如下所示:

  • You put a CD into the cdrom drive the BIOS knows how to use the cdrom enough to get the boot program on the cdrom (isolinux).

    您将CD放入cdrom驱动器中,BIOS知道如何使用cdrom足以在cdrom(isolinux)上获取启动程序。
  • Isolinux is responsible for the menu options. Once you select a boot entry like “Start or install Ubuntu”, it calls the kernal + initrd (initial ram disk) files, copies them into memory and passes parameters to them.

    Isolinux负责菜单选项。 一旦选择了诸如“启动或安装Ubuntu”之类的启动项,它将调用kernal + initrd(初始ram磁盘)文件,将它们复制到内存中并将参数传递给它们。
  • The now in RAM and in control kernel + initrd start the boot process, while using the parameters that where passed to them to determine things like: should the splash screen be shown? should the output be verbose?.

    现在,RAM中和控制内核中的initrd会启动引导过程,同时使用传递给它们的参数来确定诸如以下内容:应该显示启动屏幕吗? 输出应该详细吗?
  • When the inirtrd scripts have finished loading drivers and device information, they look for the Ubuntu liveCD files to continue the boot process. The normal behavior is to look in the local physical cdrom drive.

    当inirtrd脚本完成加载驱动程序和设备信息时,它们会寻找Ubuntu liveCD文件来继续启动过程。 正常的行为是查看本地物理cdrom驱动器。

For network boot:

对于网络启动:

  • Instead of a local media such as a CD, the client is booted using it’s network card (PXE) and is supplied with PXElinux over TFTP.

    客户端使用其网卡(PXE)引导,而不是CD等本地介质,并通过TFTP与PXElinux一起提供。
  • Just like Isolinux, PXElinux is responsible for the menu options. Once you select a boot entry, it calls the Ubuntu kernal + initrd files, copies them into memory and passes parameters to them.

    就像Isolinux一样,PXElinux负责菜单选项。 选择启动项后,它将调用Ubuntu内核+ initrd文件,将它们复制到内存中并将参数传递给它们。
  • The now in RAM and in control kernel +  initrd start the boot process, with our additional information that they should not be looking for the boot files in the client’s local physical cdrom drive, but rather in an NFS share on our FOG server.

    现在在RAM中,并控制内核的initrd +开始启动过程中,我们更多的信息,他们应该找在客户端的本地物理光盘驱动器启动文件,而是在我们的FOG服务器上的NFS共享。

Smile

This is possible because the Ubuntu creators have enabled networking by integrating, network cards drivers and protocols into the kernel + initrd files. For such an act, we can only say thank you to the Ubuntu team.

这是可能的,因为Ubuntu创建者已通过将网卡驱动程序和协议集成到内核+ initrd文件中来启用联网。 对于这种行为,我们只能向Ubuntu团队表示感谢。

Make the Ubuntu files available on the server

使Ubuntu文件在服务器上可用

The first step is to make the Ubuntu files available on the server. You may opt to simply copy them from the CD drive, or extract them from the ISO, and that will work just fine. With that said, we will make the ISO auto-mounted. While not a must, doing this will enable you to use our “How to Upgrade your Ubuntu ISO Without Re-downloading” guide, to upgrade the Ubuntu version of your network boot without going through all the procedures from scratch or alternatively, replace a single file to update the entire entry.

第一步是使Ubuntu文件在服务器上可用。 您可以选择简单地从CD驱动器中复制它们,或从ISO中提取它们,这样就可以正常工作。 话虽如此,我们将使ISO自动挂载。 虽然不是必须的,但是这样做将使您能够使用我们的“ 如何在不重新下载的情况下升级Ubuntu ISO ”指南,升级网络启动的Ubuntu版本而无需从头开始进行所有过程,或者替换一个文件以更新整个条目。

With the above said, This author likes keeping a couple of past versions around, until the new one has been proven absolutely stable and issues free. That is why we will make a sub-directory and mount point according to version, but know that you could bypass that to have your single point of update.

综上所述,本文作者喜欢保留几个以前的版本,直到新版本被证明绝对稳定且没有问题。 这就是为什么我们将根据版本创建子目录和挂载点,但是知道您可以绕过该目录以进行单点更新。

  1. Copy the ISO into the “/tftpboot/howtogeek/linux” directory

    将ISO复制到“ / tftpboot / howtogeek / linux ”目录中

  2. Create the mount point:

    创建安装点:

    sudo mkdir -p /tftpboot/howtogeek/linux/ubuntu/<version-of-ubuntu>

    sudo mkdir -p /tftpboot/howtogeek/linux/ubuntu/<version-of-ubuntu>

  3. Edit the “fstab” file to have the ISO auto-mounted at boot:

    编辑“ fstab ”文件以在启动时自动挂载ISO:

    sudo vim /etc/fstab

    sudo vim /etc/fstab

  4. Append to “fstab” the ISO mount entry:

    附加到“ fstab” ISO安装条目:

    /tftpboot/howtogeek/linux/ubuntu-11.04-desktop-amd64.iso /tftpboot/howtogeek/linux/ubuntu/11.04 udf,iso9660 user,loop 0 0

    /tftpboot/howtogeek/linux/ubuntu-11.04-desktop-amd64.iso /tftpboot/howtogeek/linux/ubuntu/11.04 udf,iso9660 user,loop 0 0

    Note: Despite representation, this is one unbroken line.

    注意:尽管有代表性,但这是一条连续的线。

  5. Test that the mount point works by issuing:

    通过发出以下命令来测试安装点是否正常工作:

    sudo mount -a

    sudo mount -a

  6. If all went well, you should be able to list the contents of the ISO by issuing:

    如果一切顺利,您应该可以通过发出以下命令列出ISO的内容:

    ls -lash /tftpboot/howtogeek/linux/ubuntu/11.04/

    ls -lash /tftpboot/howtogeek/linux/ubuntu/11.04/

Create an NFS share

创建一个NFS共享

While the boot procedure starts by using PXE, the actual heavy lifting is done by the NFS share on the server. As we are basing this guide on our FOG server, the NFS components and some configurations have already been done for us by the FOG team, and all we have to do is add to them our Ubuntu share.

当启动过程通过使用PXE启动时,实际的繁重工作由服务器上的NFS共享完成。 当我们将本指南基于FOG服务器时,FOG团队已经为我们完成了NFS组件和一些配置,而我们要做的就是在其中添加我们的Ubuntu份额。

  1. Edit the “exports” file to add the new share:

    编辑“导出”文件以添加新共享:

    sudo vim /etc/exports

    sudo vim /etc/exports

  2. Append to it the pointer to our ISO mount point:

    附加指向我们ISO挂载点的指针:

    /tftpboot/howtogeek/linux/ubuntu/11.04/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)

    /tftpboot/howtogeek/linux/ubuntu/11.04/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)

  3. Restart the NFS service for the settings to take affect:

    重新启动NFS服务以使设置生效:

    sudo /etc/init.d/nfs-kernel-server restart

    sudo /etc/init.d/nfs-kernel-server restart

PXE menu setup

PXE菜单设置

Edit the “Linux stuff” menu:

编辑“ Linux东西”菜单:

sudo vim /tftpboot/howtogeek/menus/linux.cfg

sudo vim /tftpboot/howtogeek/menus/linux.cfg

Append to it the following:

附加以下内容:

LABEL Ubuntu Livecd 11.04
MENU DEFAULT
KERNEL howtogeek/linux/ubuntu/11.04/casper/vmlinuz
APPEND root=/dev/nfs boot=casper netboot=nfs nfsroot=<YOUR-SERVER-IP>:/tftpboot/howtogeek/linux/ubuntu/11.04 initrd=howtogeek/linux/ubuntu/11.04/casper/initrd.lz quiet splash --

LABEL Ubuntu Livecd 11.04
MENU DEFAULT
KERNEL howtogeek/linux/ubuntu/11.04/casper/vmlinuz
APPEND root=/dev/nfs boot=casper netboot=nfs nfsroot=<YOUR-SERVER-IP>:/tftpboot/howtogeek/linux/ubuntu/11.04 initrd=howtogeek/linux/ubuntu/11.04/casper/initrd.lz quiet splash --

The above may look messy at first glance but all you have to do is replace *<YOUR-SERVER-IP> with the IP of your server NFS/PXE server.

上面的内容乍看之下似乎很混乱,但是您要做的就是用服务器NFS / PXE服务器的IP替换* <YOUR-SERVER-IP>。

For a clearer geek understanding, the text above will:

为了更清楚地了解极客,上面的文本将是:

  • Create a new PXE entry in the“Linux” sub-menu called “Ubuntu 11.04”.

    在名为“ Ubuntu 11.04”的“ Linux”子菜单中创建一个新的PXE条目。
  • Because of the “MENU DEFAULT” parameter, this entry will be automatically selected when entering the “Linux” sub-menu.

    由于使用了“ MENU DEFAULT”(菜单默认)参数,因此在进入“ Linux”子菜单时将自动选择该条目。
  • Point the client to take the kernel + initrd files usinf TFTP from the relative path in the “/tftproot” directory of “howtogeek/linux/ubuntu…”

    指向客户端,从“ howtogeek / linux / ubuntu…”的“ / tftproot”目录中的相对路径获取usinf TFTP的内核和initrd文件。
  • Point the initrd scripts to mount the “root” filesystem from the NFS share on the absolute path of “<YOUR-SERVER-IP>:/tftpboot/howtogeek…”

    指向initrd脚本以将NFS共享中的“根”文件系统挂载在“ <YOUR-SERVER-IP>:/ tftpboot / howtogeek…”的绝对路径上。

Note: I have tried (and failed) to use a DNS name instead of an IP for the “<YOUR-SERVER-IP>”, I’m guessing that at that stage of the boot process there simply still isn’t support for DNS… success stories are welcomed.

注意我已经尝试(但失败了)使用DNS名称代替“ <YOUR-SERVER-IP>”的IP,我猜测在启动过程的那个阶段,仍然不支持DNS ...成功的故事受到欢迎。

Possible procedures

可能的程序

You should now be able to boot a client into Ubuntu from PXE (Usually F12).

现在,您应该能够从PXE(通常为F12)将客户端引导到Ubuntu。

At this stage we suggest you take the time to review some of the things you can do with this outstanding tool:

在此阶段,我们建议您花些时间回顾一下使用此出色工具可以完成的操作:

One last thing, If you create your Ubuntu ISO, using this online builder, you will be able to slipstream all of the articles above into your PXE bootable Ubuntu.

最后一件事,如果您使用此在线生成器创建Ubuntu ISO,则可以将上述所有文章整合到可启动PXE的Ubuntu中。



Ubuntu is everything, all that once was and all that will be, Ubuntu controls time and space, Love and Death, Ubuntu can see into your mind, Ubuntu can see into your SOUL!!

Ubuntu拥有一切,曾经的一切都将成为一切,Ubuntu控制时间和空间,爱与死,Ubuntu可以进入您的心灵,Ubuntu可以进入您的灵魂!

翻译自: https://www.howtogeek.com/61263/how-to-network-boot-pxe-the-ubuntu-livecd/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值