+ -

用PXE引导安装SUSE

时间:2008-04-11

来源:msj0520

在手机上看
手机扫描阅读

Revision as of 09:34, 11 九月 2007


Contents

[hide]
  • 1 Introduction
  • 2 介绍
  • 3 Getting ready
  • 4 准备工作
  • 5 Configuring dhcpd & TFTP server
  • 6 配置dhcpd和TFTP服务器
    • 6.1 dhcpd config
    • 6.2 dhcpd配置
    • 6.3 atftpd config
    • 6.4 atftpd 配置
    • 6.5 tftpd-hpa config
    • 6.6 tftpd-hpa配置
  • 7 Setting up PXE boot environment
  • 8 建立PXE引导环境
    • 8.1 Getting all
    • 8.2 获取所有的东西
    • 8.3 Building PXE boot
    • 8.4 建立PXE启动
  • 9 Booting PXE
  • 10 启动PXE
  • 11 Gotchas / Common issues
    • 11.1 PXELINUX boot is very slow
    • 11.2 PXELINUX启动非常慢
    • 11.3 No options accepted
    • 11.4 没有接受的选项
    • 11.5 Socket errors when running in.tftpd
    • 11.6 当运行in.tftpd提示套接字错误
  • 12 Starting the Graphical Install System
  • 13 启动图形安装系统
    • 13.1 Troubleshooting
    • 13.2 解决问题
      • 13.2.1 Text based YaST Loads Instead of X Server
      • 13.2.2 基于文件的YaST,而不是X服务器
  • 14 Links for additional information
  • 15 附加信息的链接

Introduction

介绍

Since the SUSE Linux distribution is very up to date, it changes often. Thus, it could be pleasant to install systems without burning new CDs or DVDs for each installation. So here is the best way to install SuSE fully from network. 既然SUSE Linux分发是非常新的,它经常更新。然而,不用刻录新的CD或DVD光盘就能安装系统将更另人高兴。因此,这为您提供了从网络安装SuSE的最好方式。

PXE is way to start computers without Floppy/Hard Disk/CD-ROM, that is, the BIOS will start right from the network using the PXE protocol. Of course, in order for PXE to work the server needs OS configuration, and the client side needs a code module that runs PXE for the given LAN card (NIC). Most newer mainboards that have an on-board LAN port already have the module as part of their BIOS image. If you want to boot from a daughterboard NIC, i.e. a card in a ISA/PCI/etc. slot, you need to put the proper module either on a BootROM (only applicable when the NIC has a ROM socket), or into the BIOS image (only applicable when there is a proper image tool available, AMIFLASH is one). Few OSes support PXE Server configuration - but Windows 2000 Server & SUSE Linux do. PXE是在没有软驱、硬盘、CD-ROM的情况下启动计算机的一种方式,也就是BIOS将使用PXE协议从网络启动。当然,为了使PXE工作服务器需要配置OS,并且客户端需要使用特定的LAN网卡(NIC)的代码模块来运行PXE。多数的新主板都有板载LAN端口并在BIOS的镜像中已经包含了这个模块。如果您想从子板NIC(如ISA/PCI插槽上的网卡)启动,您需要安装合适的模块在启动ROM(只有当NIC有ROM插槽时才可用)或在BIOS镜像中(当有合适的镜像工具才可用,AMIFLASH就是一个)。很少有操作系统支持PXE服务器配置--但是Windows 2000服务器和SUSE Linux却支持。

Getting ready

准备工作

For a successful networked install, you should have: 为了成功的进行网络安装,您需要:

  • an existing SuSE Linux (hosting dhcpd and tftpd),
  • an internet connection (broadband highly recommended),
  • a networked target system supporting PXE boot.
  • 一个现存的SuSE Linux (开有dhcpd和tftpd服务),
  • 一个可用的网络连接(推荐使用高带宽的),
  • 一个支持PXE启动的可连网的需要安装的目标系统。

Configuring dhcpd & TFTP server

配置dhcpd和TFTP服务器

dhcpd config

dhcpd配置

PXE boot is based on a BOOTP server which will send all the essential information for the system to start its network layer. That job could be done with the well known DHCPd server included in SuSE distribution since you set up a static configuration. Here is the typical configuration (default configuration file is /etc/dhcpd.conf): PXE启动是基于BOOTP服务器,这将发送所有必需的信息来启动自身的网络层,这可以通过从所周知的DCHPD服务器来实现,该安装包包含在SuSE的分发中。下面是一个典型的配置(/etc/dhcpd.conf是缺省的配置文件): host target_host {

 hardware ethernet xx:xx:xx:yy:yy:yy; fixed-address 192.168.1.10; server-name "192.168.1.1"; next-server 192.168.1.1; filename "/tftpboot/pxelinux.0"; 

} Notice that 2 lines are added specialy for the PXE boot. Indeed it is necessary to specify the TFTP boot server IP (server-name) and the filename containing PXE bootstrap (filename). You need to (re)start the DHCPd server as follows: 注意要以PXE启动需要添加两行,指定TFTP启动服务器IP(server-name)和包含PXE引导程序的文件名(filename)。您需要按照下面方式重新启动DHCPd服务器:

# rcdhcpd restart 

Please Note: Depending on which tftp server you use and wether it runs in a chroot environment the "filename" may have to be specified without a leading path element. For the standard tftpd server on openSUSE or if you are using a RedHat based server, the "filename" should read:

filename "pxelinux.0"; 

请注意:依赖于您使用的tftp服务器和是否它运行在chroot环境,"filename"也可以在被指定时没有路径引导符。在openSUSE上的标准tftpd服务器或使用基于RedHat的服务器,"filename"应该为:

filename "pxelinux.0"; 

With the ISC DHCP server version 3 (shipped on openSUSE) it is possible to configure the DHCP server to only respond to booting requests and this way run it in parallel with another default dhcp server. This may be desireable in case the default dhcp server can not be configured to supply a boot server or boot file name (this is the case with many DSL routers). The PXE client will ingore DHCP offers that do not contain a boot server or boot file name. Below is a complete configuration file for this scenario: 在ISC DHCP服务器版本3(迁移到openSUSE)中,配置DHCP服务器只响应启动请求,这种方式可以与另一个缺省的DHCP服务器并行运行。这个也许在DHCP服务器不能被配置提供启动服务器或启动文件名(这种情况也放有很多DSL路由器)的情况下很有用。PXE客户端将忽略DHCP不包含启动服务器或启动文件名。下面是本方案的完整的配置文件:

default-lease-time 600; max-lease-time 7200; ddns-update-style none; ddns-updates off; allow booting; option domain-name "my.domain"; option domain-name-servers my.dnsserver; option routers my.router; # define rules to identify DHCP Requests from PXE and Etherboot clients. # 定义规则来识别来自于PXE和Etherboot客户端的DHCP请求。 class "pxe" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; } class "etherboot" { match if substring (option vendor-class-identifier, 0, 9) = "Etherboot"; } subnet 192.168.1.0 netmask 255.255.255.0 { option broadcast-address 192.168.1.255; pool { default-lease-time 180; # no long lease time required for booting max-lease-time 360; # booted system does its own dhcp request server-name "mybootserver"; next-server mybootserver.; # in case your local DNS only handles # unqualified domains keep trailing '.' filename "pxelinux.0"; allow members of "pxe"; allow members of "etherboot"; # allow etherboot, too range 192.168.1.201 192.168.1.211; } } 

atftpd config

atftpd 配置

It is recommended to use atftp package because atftp is the only free TFTP server complying with all RFC. Once installed, you should check that everything is OK in /etc/sysconfig/atftp. Here is the typical configuration: 推荐使用atftp包,因为atftp是唯一的免费的符合RFC规范的TFTP服务器。一旦安装,您应该检查/etc/sysconfig/atftp中的每一项是否OK。下面是一个典型的配置:

ATFTPD_OPTIONS="--daemon --user tftp -v" ATFTPD_USE_INETD="no" ATFTPD_DIRECTORY="/srv/tftp" 

In this example, note that the tftp root directory is set to /srv/tftp. You need to (re)start the TFTP server as follows: 在这个例子中,注意tftp根目录设置到了/srv/tftp。您需要按照下面的方式重新启动TFTP服务器:

# rcatftpd restart 

Please Note: The default tftp server that accompanies RedHat Enterprise Linux will do just fine. And will not require any further configuration. Simply start the service using the following command. 请注意:RedHat企业版本的Linux中缺省的tftp服务器也工作的很好。它不需要进一步的配置,简单地使用下面的命令启动服务即可。

chkconfig tftp on 

tftpd-hpa config

tftpd-hpa配置

tftpd-hpa is the tftpd server from H. Peter Anvin, available in the "tftpd" package. In its default setup, it is configured to be started from xinetd and will chroot to the directory specified in /etc/xinetd.d/tftp, usually /tftpboot. Options to run as unprivileged user are to be made on behalf xinetd (that is, /etc/xinetd.d/tftp). tftpd-hpa是H. Peter Anvin编写的一个tftpd服务器,包含在"tftpd"的包中。在缺省的设置中,它被配置从xinetd启动并更改目录到/etc/xinetd.d/tftp中指定的目录,通常为/tftpboot。以无权限的用户运行的选项也可以被xinetd设置(也就是/etc/xinetd.d/tftp)。


Setting up PXE boot environment

建立PXE引导环境

Getting all

获取所有的东西

Before really starting to build the PXE environment, you have to install the syslinux package. This package provides a very usefull file:

 /usr/share/syslinux/pxelinux.0 

If you can not install syslinux, you can download this little file here. 在真正开始建立PXE环境之前,您必须安装syslinux包,这个包提供一个非常有用的文件:

 /usr/share/syslinux/pxelinux.0 

如果您没安装syslinux,您可以在这下载这个小文件。

Building PXE boot

建立PXE启动

At that point, you should have everything to build your PXE boot environment. Jump in the TFTP root directory (default is /srv/tftp) and create the initial structure as shown below: 到此为止,您应该具备了建立PXE启动环境的所有东西。进入TFTP根目录(缺省的是/srv/tftp),按下面的命令创建相应的文件和目录:

# cd /srv/tftp # mkdir tftpboot # cd tftpboot # mkdir pxelinux.cfg 

Copy PXE bootstrap file in tftpboot directory. 复制PXE引导文件到tftpboot目录下。

# cp /usr/share/syslinux/pxelinux.0 /srv/tftp/tftpboot 

Create now the PXE config file. This one is not far in its structure from the syslinux.cfg file. 创建新的PXE配置文件,这个类似于syslinux.cfg文件的结构。

# vi /srv/tftp/tftpboot/pxelinux.cfg/default 

Here is a sample one provided as is, feel free to adapt it to fit your configuration. 这有一个简单的例子,随便更改它以满足您的配置需求。

default linux prompt 1 timeout 30 # Install Linux label linux kernel linux append initrd=initrd splash=silent showopts 

Please Note: If you are using a RedHat based server, your default configuration will need a few more options for the line begining with "append": 请注意:如果您使用基于RedHat的服务器,您的缺省配置将需要一些以"append"开头的选项:

append root=/dev/ram0 load_ramdisk=1 initrd=initrd splash=silent showopts ramdisk_size=4096 init=linuxrc 

This configuration file refers to 2 important files: linux and initrd. They have to be downloaded from the network SuSE install repository (or a mirror). Notice they depend on your hardware (i386 or x86_64). 这个配置文件引用了2个重要的文件:linux和initrd。您必须从网络上的SuSE安装仓库(或其它镜像)下载这两个文件。注意这两个文件依赖于您的硬件平台(i386或x86_64)。

  • eg. for i386:
  • 针对i386的例子:
# cd /srv/tftp/tftpboot # wget http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/boot/i386/loader/initrd # wget http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/boot/i386/loader/linux 
  • eg. for x86_64:
  • 针对x86_64的例子:
# cd /srv/tftp/tftpboot # wget http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/boot/x86_64/loader/initrd # wget http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/boot/x86_64/loader/linux 

Please Note: If you are using a RedHat based server, your directory structure for the tftp-server should be as follows: 请注意:如果您使用基于RedHat的服务器,您的tftp服务器的目录结构应该如下所示:

/tftpboot /tftpboot/pxelinux.0 /tftpboot/initrd.img /tftpboot/vmlinuz /tftpboot/pxelinux.cfg /tftpboot/pxelinux.cfg/default 

Booting PXE

启动PXE

You should ensure that your target host is well configured to boot from network and check that PXE is enabled. Then everything will run as accordingly... enjoy PXE & have a lot of fun! 您应该确认您的目标主机已经配置好从网络启动并检查PXE是否已经启动。然后每件事都会按照我们想的运行...享受PXE并尽情玩吧!

Gotchas / Common issues

PXELINUX boot is very slow

PXELINUX启动非常慢

You may find that while PXELINUX loads, it then seems to take a really long time going through all the different lines like: 当PXELINUX加载时您也许会发现好像花了很长时间来显示类似于下面的所有不同的行:

pxelinux.cfg/01-88-99-aa-bb-cc-dd pxelinux.cfg/C000025B pxelinux.cfg/C000025 pxelinux.cfg/C00002 pxelinux.cfg/C0000 pxelinux.cfg/C000 pxelinux.cfg/C00 pxelinux.cfg/C0 pxelinux.cfg/C pxelinux.cfg/default 

You have to make sure that you have next-server in your /etc/dhcpd.conf file set to the address of your tftp server. You don't have to do a hostname, as is shown in the examples, you can have just a line like this: 您必须确认在/etc/dhcpd.conf的配置文件中有next-server来设置您tftp服务器的地址。您不必包含hostname,如例子中所示,只要下面一行即可:

next-server 192.168.77.254; 

No options accepted

没有接受的选项

You might also get warning messages like the following in /var/log/messages: 您也许会在/var/log/messages看到一些如下的警告信息:

in.tftpd: tftp: client does not accept options 

This is normal. PXELINUX does not seem to accept all options, but it does not impact booting. 这个是正常的。PXELINUX好像不能接受所有的选项,但是这不影响启动。

Socket errors when running in.tftpd

当运行in.tftpd提示套接字错误

If you get errors like: 如果您看到了如下的错误:

in.tftpd: cannot bind to local socket: Address already in use 

Then you might have mis-configured the options for the server in /etc/xinet.d/tftp. Check those options carefully. 那么您也许在/etc/xinet.d/tftp文件中缺少了服务器配置的一些选项。请仔细的检查一下。

Starting the Graphical Install System

启动图形安装系统

After the PXE loaded install system has finished loading drivers you will be presented with a message saying that the openSUSE Install CD could not be found. Hit OK. You will then be asked to select your language and keyboard map. 在PXE加载的安装系统完成了加载驱动后,您将会看到一个消息说openSUSE的安装CD不能被发现。单击OK。然后,您需要选择语言和键盘布局。

Once at the Main Menu, select "Start Installation or System", then "Start Instillation or Update". Next choose Network as the source medium to install from. You now need to locate an internet instillation repository to install from. Select an appropriate mirror from Mirrors Released Version. I chose: 一旦进入主菜单,选择"Start Installation or System",然后"Start Instillation or Update"。下一步选择安装的网络源。您需要指定一个网络仓库来安装。从Mirrors Released Version中选择一个合适的镜像。我选择了:

ftp://ftp.mirrorservice.org/sites/ftp.opensuse.org/pub/opensuse/distribution/10.2/repo/oss/ 

Now select FTP or HTTP depending on the type of mirror you chose. Now choose the appropriate network device, and use DHCP. You will next be asked for the IP address of the server. Despite the request for an IP address, a hostname works fine, eg: 现在依赖于您的镜像类型来选择FTP或HTTP。选择合适的网卡并使用DHCP。接下来您将被要求指定服务器的地址。虽然需要一个IP地址,您也可以设置个主机名,如:

ftp.mirrorservice.org 

Next you will be asked to enter the directory on the server, eg: 下一步您将被要求输入服务器上的目录,如:

/sites/ftp.opensuse.org/pub/opensuse/distribution/10.2/repo/oss/ 

The graphical instillation system will then be downloaded from your mirror. You may be told "Installation system does not match your boot medium.". Ignore this and continue. After a short pause the full graphical YaST should be loaded. You can now proceed with the instillation as normal. 然后,从您的镜像中下载图形安装系统。您也许碰到"Installation system does not match your boot medium."忽略这个继续。在一段短暂的停顿后,完整的图形化的YaST应该会被加载。现在您就能够按通常的方法来安装系统。

Troubleshooting

解决问题

Text based YaST Loads Instead of X Server

基于文件的YaST,而不是X服务器

If your computer is not too low spec to use the GUI installer you may be able to get the X Server to start by manually specify a resolution and colour depth to use. I found this to be the case with my Latitude C400 laptop. To do this, go back to your TFTP server and edit the pxelinux.cfg/default file. On the line: 如果您的计算机不是太慢而不能使用图形用户界面(GUI)的安装程序,那么您能够在X服务器上通过手动来指定想要使用的分辨率和色深。我的Latitude C400笔记本电脑上就可以设置。回到TFTP服务器,编辑pxelinux.cfg/default文件。在这行:

 append initrd=initrd splash=silent showopts 

add the following: 添加正在的选项:

vga=xxx 

where xxx is a Linux video mode number for a mode you know your monitor/graphics card works with. eg: xxx是Linux视频模式编号,您知道的您的监视器/显卡所工作的模式。如:

 append initrd=initrd splash=silent showopts vga=773 

You can find a list of Linux video mode numbers here. Boot with PXE again and the X Server should start properly. 您能够在这找到Linux视频模式编号列表。重新以PXE启动,X服务器应该能正确地启动。

Links for additional information

附加信息的链接

-- MightyBob 16:34, 1 April 2006 (UTC)

Retrieved from "http://cn.opensuse.org/%E7%94%A8PXE%E5%BC%95%E5%AF%BC%E5%AE%89%E8%A3%85SUSE"

热门下载

更多