linux 相關配置
要引導安裝linux,需要把相關linuxISO文件中的相關文件複製出來,主要是核心文件(vmlinuz)和初始內存盤(initrd.img)以及isolinux.cfg配置文件。有以下區別:
CentOS5.x(RHEL 5.x,Oracle Linux 5.x)
需要複製isolinux下的相關文件,安裝時可以添加method=hd:sda1:/路徑指定iso文件的位置,需要注意的是在安裝的過程中grub一定要安裝到本地硬盤的MBR(可能需要調整一下磁盤識別的順序,將本地硬盤調整到最前)
CentOS6.x(RHEL 6.x,Oracle Linux6.x)
需要複製isolinux下的相關文件並加上images下的相關文件,安裝時需要找到images目錄下的install.img文件,可以在安裝參數中添加askmethod手動加載或者指定stage2=path來指定install.img的路徑,再或者指定repo=path 或者method=path 並保證路徑下包含install.img。
SUSELinux 10/11
需要複製/boot/x86_64/loader下的內容。
注意:安裝時需要調整的位置
將相關LINUX ISO中的配置文件複製到/boot/linux/自定義的相關目錄下。我的目錄在/boot/linux下,如圖:
新建 /boot/config/linux.cfg Linux主配置文件
include /boot/config/common.cfg #包含公用配置 default redhat64x64 #默認菜單項 label centos6364 #菜單項 menu label Install CentOS 6.3 X86_64 #菜單顯示標題 kernel /boot/syslinux/vesamenu.c32 #加載圖形菜單 append /boot/linux/centos63/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label suse10 text help #幫助提示信息,在此提示iso文件的路徑 iso path:/ISO/linux/suse1064.iso endtext menu label Install Suse Enterprise Server 10 SP4 x86-64 #顯示標題 kernel /boot/syslinux/vesamenu.c32 #加載圖形菜單 append /boot/linux/suse1064/isolinux.cfg /boot/config/mainmenu.cfg #加載suse配置文件 menu separator label Suse11sp3 text help iso path:/ISO/linux/suse11sp364.iso endtext menu label Install Suse Enterprise Server 11 SP3 X86-64 kernel /boot/syslinux/vesamenu.c32 append /boot/linux/suse11364/isolinux.cfg #加載具體配置文件 menu separator label redhat5432bit text help iso path:/ISO/linux/rh5432.iso endtext menu label Install Redhat Enterprise Server 5.4 32Bit kernel /boot/syslinux/vesamenu.c32 append /boot/linux/rh5432/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label redhat5464bit text help iso path:/ISO/linux/rh5464.iso endtext menu label Install Redhat Enterprise Server 5.4 64Bit kernel /boot/syslinux/vesamenu.c32 config /boot/linux/rh5464/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label redhat5864bit text help iso path:/ISO/linux/rh5864.iso endtext menu label Install Redhat Enterprise Server 5.8 64Bit kernel /boot/syslinux/vesamenu.c32 config /boot/linux/rh5864/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label redhat63x64 text help iso path:/boot/linux/rh6364/rhel6364.iso. install.img path is :/boot/linux/rh6364/images endtext menu label Install Redhat Enterprise Server 6.3 64Bit kernel /boot/syslinux/vesamenu.c32 config /boot/linux/rh6364/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label redhat64x64 text help iso path:/boot/linux/rh6464/rh6464.iso. install.img path is :/boot/linux/rh6464/images endtext menu label Install Redhat Enterprise Server 6.4 64Bit kernel /boot/syslinux/vesamenu.c32 append /boot/linux/rh6464/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label redhat65x64 text help iso path:/boot/linux/rh6564/rh6564.iso. install.img path is :/boot/linux/rh6564/images endtext menu label Install Redhat Enterprise Server 6.5 64Bit kernel /boot/syslinux/vesamenu.c32 append /boot/linux/rh6564/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label oracle5864bit text help iso path:/boot/linux/ol5864/ol5864.iso endtext menu label Install Oracle Linux 5.8 64Bit kernel /boot/syslinux/vesamenu.c32 config /boot/linux/ol5864/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label oracle64x64 text help iso path:/boot/linux/ol6464/ol6464.iso. install.img path is :/boot/linux/ol6464/images endtext menu label Install Oracle Linux 6.4 64Bit kernel /boot/syslinux/vesamenu.c32 append /boot/linux/ol6464/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label oracle65x64 text help iso path:/boot/linux/ol6564/ol6564.iso. install.img path is :/boot/linux/ol6564/images endtext menu label Install Oracle Linux 6.5 64Bit kernel /boot/syslinux/vesamenu.c32 append /boot/linux/ol6564/isolinux.cfg /boot/config/mainmenu.cfg #加載具體配置文件 menu separator label debian564 menu hide menu label Install Debian 5.04 AMD64 kernel /boot/deb564/vmlinuz append vga=normal initrd=/boot/deb564/initrd.gz -- quiet menu separator label debian532 menu hide menu label Install Debian 5.04 I386 kernel /boot/deb532/vmlinuz append linux load_ramdisk=1 video=vesa:ywrap,mtrr initrd=/boot/deb532/initrd.gz -- quiet
這裏有一個共同點,就是基本上所有的LINUX ISO或光盤的啓動程序都是使用的ISOLINUX,配置文件都是isolinux.cfg。配置文件中最主要的區別是append和config。append是附加選項,而config是使用新的配置文件重新加載boot loader。我一般在 5.x的時候使用config加載,比較方便輸入5.x提供的選項。而6.x使用append可以加載ISO提供的圖形菜單。
我們取幾個/boot/linux下有代表性的配置來看一下。(主要內容爲原ISO內容,需要根據我們拷貝的情況改動一下路徑,如果有特殊需求,可以在此添加參數)
/boot/linux/ol5864/isolinux.cfg
default linux #默認菜單項 prompt 1 timeout600 #超時時間 display/boot/linux/ol5864/boot.msg #一些系統提示的信息 F1/boot/linux/ol5864/boot.msg F2/boot/linux/ol5864/options.msg F3/boot/linux/ol5864/general.msg F4/boot/linux/ol5864/param.msg F5/boot/linux/ol5864/rescue.msg labellinux kernel /boot/linux/ol5864/vmlinuz append linux load_ramdisk=1 initrd=/boot/linux/ol5864/initrd.imgmethod=hd:sda1:/boot/linux/ol5864/ #method指定iso在U盤的路徑 labeltext kernel /boot/linux/ol5864/vmlinuz append linux load_ramdisk=1initrd=/boot/linux/ol5864/initrd.img method=hd:sda1:/boot/linux/ol5864/ text #text指定文本方式安裝 label ks kernel /boot/linux/ol5864/vmlinuz append ksinitrd=/boot/linux/ol5864/initrd.img method=hd:sda1:/boot/linux/ol5864/ks=hd:sda1:/boot/linux/ol5864/pc.ks ksdevice=eth0 #通過kickstart應答自動安裝。 labellocal localboot 1 labelmemtest86 kernel /boot/linux/ol5864/memtest append -
注意:5.x的Linux如果安裝時沒有發現U盤,可以按F2加載usbstorage驅動。如果要加載額外的驅動也可以在安裝參數後加dd來加載。
/boot/linux/rh6564/isolinux.cfg
default linux #prompt1 timeout600 display/boot/linux/rh6564/boot.msg menubackground /boot/linux/rh6564/splash.jpg #菜單背景圖片 menutitle Welcome to Red Hat Enterprise Linux 6.5! menucolor border 0 #ffffffff #00000000 menucolor sel 7 #ffffffff #ff000000 menucolor title 0 #ffffffff #00000000 menucolor tabmsg 0 #ffffffff #00000000 menucolor unsel 0 #ffffffff #00000000 menucolor hotsel 0 #ff000000 #ffffffff menucolor hotkey 7 #ffffffff #ff000000 menucolor scrollbar 0 #ffffffff #00000000 labellinux menu label ^Install or upgrade an existing system kernel /boot/linux/rh6564/vmlinuz append initrd=/boot/linux/rh6564/initrd.img method=hd:LABEL=OEMDRV:/boot/linux/rh6564 labellinuxks menu label ^Install or upgrade an existingsystem kickstart menu default kernel /boot/linux/rh6564/vmlinuz append initrd=/boot/linux/rh6564/initrd.img ks=hd:sda1:/boot/linux/rh6564/pc.ks ksdevice=eth0 #通過kickstart應答自動安裝。 labelvesa menu label Install system with ^basic video driver kernel /boot/linux/rh6564/vmlinuz append initrd=/boot/linux/rh6564/initrd.img xdriver=vesa nomodeset labelrescue menu label ^Rescue installed system kernel /boot/linux/rh6564/vmlinuz append initrd=/boot/linux/rh6564/initrd.img rescue labellocal menu label Boot from ^local drive localboot 0xffff labelmemtest86 menu label ^Memory test kernel /boot/linux/rh6564/memtest append-
注意:紅帽系的操作系統6.x可以通過多個參數加載ISO,如repo=path,method=path。還有stage2=imagespath指定install.img的路徑。另外也可以使用U盤的標籤來加載U盤。
/boot/linux/suse11364
defaultlinux #install labellinux kernel /boot/linux/suse11364/linux #suse的核心是linux append initrd=/boot/linux/suse11364/initrdsplash=silent showopts vga=0x317 install="hd:/dev/sda1/ISO/linux/suse11sp364.iso" #指定suse的ISO位置 labellinux with drivers kernel /boot/linux/suse11364/linux append initrd=/boot/linux/suse11364/initrdsplash=silent showopts vga=0x317 dud=1 install="hd:/dev/sda1/ISO/linux/suse11sp364.iso" #如果要額外加載驅動需要指定dud=1 # repair labelrepair kernel /boot/linux/suse11364/linux append initrd=/boot/linux/suse11364/initrdsplash=silent repair=1 showopts # rescue labelrescue kernel /boot/linux/suse11364/linux append initrd=/boot/linux/suse11364/initrdsplash=silent rescue=1 showopts #mediacheck label mediachk kernel /boot/linux/suse11364/linux append initrd=/boot/linux/suse11364/initrdsplash=silent mediacheck=1 showopts # biostest labelfirmware kernel /boot/linux/suse11364/linux appendinitrd=/boot/linux/suse11364/biostest,/boot/linux/suse11364/initrdsplash=silent install=exec:/bin/run_biostest showopts # memorytest labelmemtest kernel memtest ui /boot/syslinux/gfxboot.c32/boot/linux/suse11364/bootlogo /boot/linux/suse11364/message implicit 1 prompt 1 timeout 600
注意:suse 安裝時指定iso的位置要用install=path,附加驅動時需要用dud=1參數 。