19.2.3 配置SYSLinux服務(wù)程序

2023-05-11 10:12 更新

SYSLinux是一個(gè)用于提供引導(dǎo)加載的服務(wù)程序。與其說(shuō)SYSLinux是一個(gè)服務(wù)程序,不如說(shuō)更需要里面的引導(dǎo)文件,在安裝好SYSLinux服務(wù)程序軟件包后,/usr/share/syslinux目錄中會(huì)出現(xiàn)很多引導(dǎo)文件。

  1. [root@linuxprobe ~]# yum install syslinux
  2. Loaded plugins: langpacks, product-id, subscription-manager
  3. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  4. Resolving Dependencies
  5. --> Running transaction check
  6. ---> Package syslinux.x86_64 0:4.05-8.el7 will be installed
  7. --> Finished Dependency Resolution
  8. Dependencies Resolved
  9. ================================================================================
  10. Package Arch Version Repository Size
  11. ================================================================================
  12. Installing:
  13. syslinux x86_64 4.05-8.el7 rhel 1.0 M
  14. Transaction Summary
  15. ================================================================================
  16. Install 1 Package
  17. Total download size: 1.0 M
  18. Installed size: 2.3 M
  19. Is this ok [y/d/N]: y
  20. Downloading packages:
  21. Running transaction check
  22. Running transaction test
  23. Transaction test succeeded
  24. Running transaction
  25. Installing : syslinux-4.05-8.el7.x86_64 1/1
  26. Verifying : syslinux-4.05-8.el7.x86_64 1/1
  27. Installed:
  28. syslinux.x86_64 0:4.05-8.el7
  29. Complete!

我們首先需要把SYSLinux提供的引導(dǎo)文件復(fù)制到TFTP服務(wù)程序的默認(rèn)目錄中,也就是前文提到的文件pxelinux.0,這樣客戶(hù)端主機(jī)就能夠順利地獲取到引導(dǎo)文件了。另外在RHEL 7系統(tǒng)光盤(pán)鏡像中也有一些我們需要調(diào)取的引導(dǎo)文件。確認(rèn)光盤(pán)鏡像已經(jīng)被掛載到/media/cdrom目錄后,使用復(fù)制命令將光盤(pán)鏡像中自帶的一些引導(dǎo)文件也復(fù)制到TFTP服務(wù)程序的默認(rèn)目錄中。

  1. [root@linuxprobe ~]# cd /var/lib/tftpboot
  2. [root@linuxprobe tftpboot]# cp /usr/share/syslinux/pxelinux.0 .
  3. [root@linuxprobe tftpboot]# cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} .
  4. [root@linuxprobe tftpboot]# cp /media/cdrom/isolinux/{vesamenu.c32,boot.msg} .

然后在TFTP服務(wù)程序的目錄中新建pxelinux.cfg目錄,雖然該目錄的名字帶有后綴,但依然也是目錄,而非文件!將系統(tǒng)光盤(pán)中的開(kāi)機(jī)選項(xiàng)菜單復(fù)制到該目錄中,并命名為default。這個(gè)default文件就是開(kāi)機(jī)時(shí)的選項(xiàng)菜單,如圖19-4所示。

圖19-4 Linux系統(tǒng)的引導(dǎo)菜單界面

  1. [root@linuxprobe tftpboot]# mkdir pxelinux.cfg
  2. [root@linuxprobe tftpboot]# cp /media/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default

默認(rèn)的開(kāi)機(jī)菜單中有兩個(gè)選項(xiàng),要么是安裝系統(tǒng),要么是對(duì)安裝介質(zhì)進(jìn)行檢驗(yàn)。既然我們已經(jīng)確定采用無(wú)人值守的方式安裝系統(tǒng),還需要為每臺(tái)主機(jī)手動(dòng)選擇相應(yīng)的選項(xiàng),未免與我們的主旨(無(wú)人值守安裝)相?!,F(xiàn)在我們編輯這個(gè)default文件,把第1行的default參數(shù)修改為linux,這樣系統(tǒng)在開(kāi)機(jī)時(shí)就會(huì)默認(rèn)執(zhí)行那個(gè)名稱(chēng)為linux的選項(xiàng)了。對(duì)應(yīng)的linux選項(xiàng)大約在64行,我們將默認(rèn)的光盤(pán)鏡像安裝方式修改成FTP文件傳輸方式,并指定好光盤(pán)鏡像的獲取網(wǎng)址以及Kickstart應(yīng)答文件的獲取路徑:

  1. [root@linuxprobe tftpboot]# vim pxelinux.cfg/default
  2. 1 default linux
  3. 2 timeout 600
  4. 3
  5. 4 display boot.msg
  6. 5
  7. 6 # Clear the screen when exiting the menu, instead of leaving the menu displa yed.
  8. 7 # For vesamenu, this means the graphical background is still displayed witho ut
  9. 8 # the menu itself for as long as the screen remains in graphics mode.
  10. 9 menu clear
  11. 10 menu background splash.png
  12. 11 menu title Red Hat Enterprise Linux 7.0
  13. 12 menu vshift 8
  14. 13 menu rows 18
  15. 14 menu margin 8
  16. 15 #menu hidden
  17. 16 menu helpmsgrow 15
  18. 17 menu tabmsgrow 13
  19. 18
  20. 19 # Border Area
  21. 20 menu color border * #00000000 #00000000 none
  22. 21
  23. 22 # Selected item
  24. 23 menu color sel 0 #ffffffff #00000000 none
  25. 24
  26. 25 # Title bar
  27. 26 menu color title 0 #ff7ba3d0 #00000000 none
  28. 27
  29. 28 # Press [Tab] message
  30. 29 menu color tabmsg 0 #ff3a6496 #00000000 none
  31. 30
  32. 31 # Unselected menu item
  33. 32 menu color unsel 0 #84b8ffff #00000000 none
  34. 33
  35. 34 # Selected hotkey
  36. 35 menu color hotsel 0 #84b8ffff #00000000 none
  37. 36
  38. 37 # Unselected hotkey
  39. 38 menu color hotkey 0 #ffffffff #00000000 none
  40. 39
  41. 40 # Help text
  42. 41 menu color help 0 #ffffffff #00000000 none
  43. 42
  44. 43 # A scrollbar of some type? Not sure.
  45. 44 menu color scrollbar 0 #ffffffff #ff355594 none
  46. 45
  47. 46 # Timeout msg
  48. 47 menu color timeout 0 #ffffffff #00000000 none
  49. 48 menu color timeout_msg 0 #ffffffff #00000000 none
  50. 49
  51. 50 # Command prompt text
  52. 51 menu color cmdmark 0 #84b8ffff #00000000 none
  53. 52 menu color cmdline 0 #ffffffff #00000000 none
  54. 53
  55. 54 # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
  56. 55
  57. 56 menu tabmsg Press Tab for full configuration options on menu items.
  58. 57
  59. 58 menu separator # insert an empty line
  60. 59 menu separator # insert an empty line
  61. 59 menu separator # insert an empty line
  62. 60
  63. 61 label linux
  64. 62 menu label ^Install Red Hat Enterprise Linux 7.0
  65. 63 kernel vmlinuz
  66. 64 append initrd=initrd.img inst.stage2=ftp://192.168.10.10 ks=ftp://192.168.10.10/pub/ks.cfg quiet
  67. 65
  68. ………………省略部分輸出信息………………
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)