19.2.3 配置SYSLinux服務程序

2023-05-11 10:12 更新

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

    [root@linuxprobe ~]# yum install syslinux
    Loaded plugins: langpacks, product-id, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Resolving Dependencies
    --> Running transaction check
    ---> Package syslinux.x86_64 0:4.05-8.el7 will be installed
    --> Finished Dependency Resolution
    Dependencies Resolved
    ================================================================================
     Package Arch Version Repository Size
    ================================================================================
    Installing:
     syslinux x86_64 4.05-8.el7 rhel 1.0 M
    Transaction Summary
    ================================================================================
    Install 1 Package
    Total download size: 1.0 M
    Installed size: 2.3 M
    Is this ok [y/d/N]: y
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
     Installing : syslinux-4.05-8.el7.x86_64 1/1 
     Verifying : syslinux-4.05-8.el7.x86_64 1/1 
    Installed:
     syslinux.x86_64 0:4.05-8.el7 
    Complete!

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

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

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

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

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

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

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

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號